home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-17 / 154xatr.zip / 154XA_TR.DOC next >
Text File  |  1992-05-01  |  258KB  |  4,949 lines

  1.        AHA- 1540A/1542A Technical Reference
  2.                                                                             
  3. Copyright 1989 Adaptec, Inc. All rights reserved. 
  4.  
  5. No part of this publication may be reproduced, stored in a retrieval system, or 
  6. transmitted, in any form or by any means, electronic, mechanical, photocopying, 
  7. recording, or otherwise, without the prior written consent of Adaptec, Inc. 691 
  8. South Milpitas Blvd., Milpitas, CA 95035. 
  9.  
  10. TRADEMARKS 
  11.  
  12. IBM is a registered trademark, PS/2, PC AT, DOS, MS-DOS, OS/2 and Micro Channel 
  13. are trademarks of International Business Machines Corporation. SCO and SCO 
  14. XENIX are trademarks of The Santa Cruz Operation. Unix is a registered 
  15. trademark of AT & T Bell Laboratories. 
  16.  
  17. CHANGES 
  18.  
  19. The material in this manual is for information only and is subject to change 
  20. without notice. 
  21. While reasonable efforts have been taken in the preparation of this manual to 
  22. assure its accuracy, Adaptec, Inc. assumes no liability resulting from any 
  23. errors or omissions in this manual, or from the use of the information 
  24. contained herein. 
  25. Adaptec reserves the right to make changes in the product design without 
  26. reservation and without notification to its users. 
  27. Additional information may be obtained from: 
  28. Adaptec Literature Department 691 South Milpitas Blvd. Milpitas, CA 95035 
  29.  
  30. This equipment generates and uses radio frequency energy and if not installed 
  31. and used properly, that is, in strict accordance with the manufacturer's 
  32. instructions, may cause interference to radio and television reception. It has 
  33. been type tested and found to comply with the limits for a Class B computing 
  34. device in accordance with the specifications of Subpart J of Part 15 of FCC 
  35. Rules, which are designed to provide reasonable protection against such 
  36. interference in residential installation. However, there is no guarantee that 
  37. interference will not occur in a particular installation. If this equipment 
  38. does cause interference to radio or television equipment reception, which can 
  39. be determined by turning the equipment off and on, the user is encouraged to 
  40. try to correct the interference by one or more of the following measures: 
  41.     Reorient the receiving antenna     Relocate the computer with respect to the 
  42. receiver     Move the computer away from the receiver     Plug the computer into a 
  43. different outlet so that computer and receiver are on different branch circuits 
  44.  
  45. If necessary, the user should consult the dealer or an experienced 
  46. radio/television technician for additional suggestions. The user may find the 
  47. following booklet prepared by the Federal Communications Commission helpful: 
  48.     "How to Identify and Solve Radio-TV Interference Problems" This booklet is 
  49. available from the U.S. Government Printing Office, Washington, D.C. 20402, 
  50. Stock No. 004-000-00345-4. 
  51.  
  52. Warning: This equipment has been certified to comply with the limits for Class 
  53. B computing device, pursuant to Subpart J of Part 15 of FCC Rules. Only 
  54. peripherals (computer input/output devices, terminals, printers, etc.) 
  55. certified to comply with the Class B limits may be attached to this computer. 
  56. Operation with non-certified peripherals is likely to result in interference to 
  57. radio and TV reception. Also this equipment must be used with shielded power 
  58. cables and shielded I/O cables. 
  59.  
  60.  
  61. AHA-1540A and AHA-1542A Industry PC/AT-to-SCSI Host Adapter User's Manual and 
  62. Specification Copyright 1989  Adaptec, Inc. All Rights Reserved 
  63.  
  64. Reproduction or use, without express written permission from Adaptec, Inc. 
  65. and/or its licensor, of any portion of this manual is prohibited. While 
  66. reasonable efforts have been taken in the preparation of this manual to assure 
  67. its accuracy, Adaptec, Inc. assumes no liability resulting from any errors or 
  68. omissions in this manual, or from the use of the information contained herein. 
  69.  
  70.  
  71.  
  72. 1.0  Introduction........................................................1-1 
  73. 1.1  Document Scope......................................................1-1 
  74. 1.2  Purpose.............................................................1-1 
  75. 1.3  Features............................................................1-1 
  76. 1.4  Product Specifications..............................................1-2 
  77. 1.5  Reference Documents.................................................1-4 
  78.  
  79. 2.0  Host Adapter Architecture...........................................2-1 
  80. 2.1    Hardware..........................................................2-1 
  81. 2.1.1  Bus Master DMA....................................................2-1 
  82. 2.1.2  SCSI Protocol Chip................................................2-1 
  83. 2.1.3  8-Bit Memory......................................................2-1 
  84. 2.1.4  Block Diagram.....................................................2-2 
  85. 2.2    Firmware..........................................................2-4 
  86. 2.2.1  Multithreaded Operation...........................................2-4 
  87. 2.2.1.1  Mailboxes.......................................................2-4 
  88. 2.2.1.2  Command Control Block...........................................2-5 
  89. 2.2.1.3  Command Descriptor Block........................................2-6 
  90. 2.2.1.4  Principles of Operation.........................................2-6
  91. 2.2.1.5  Task Queueing...................................................2-7
  92. 2.2.2    Single Threaded Operation.......................................2-7
  93.  
  94. 3.0  Installation........................................................3-1
  95. 3.1  Unpacking and Inspecting............................................3-1
  96. 3.2  Installation........................................................3-1
  97. 3.2.1  System Configuration..............................................3-1
  98. 3.2.2  Hardware Setup....................................................3-2
  99. 3.2.3  Checklist.........................................................3-4
  100. 3.2.4  Operation Using the BIOS under DOS................................3-4
  101. 3.3  Jumper Configuration................................................3-5
  102. 3.3.1  Jumper Block J1...................................................3-6
  103. 3.3.1.1  SCSI Synchronous Negotiation....................................3-6
  104. 3.3.1.2  Diagnostic Jumper...............................................3-6
  105. 3.3.1.3  SCSI Parity.....................................................3-6
  106. 3.3.2  SCSI Address......................................................3-7
  107. 3.3.3  DMA Channel.......................................................3-7
  108. 3.3.4  AT Interrupt Channel..............................................3-9
  109. 3.3.5  DMA Transfer Speeds...............................................3-10
  110. 3.3.6  AT BIOS Wait State................................................3-10
  111. 3.3.7  AT Port Address...................................................3-11
  112. 3.3.8  AT BIOS Address...................................................3-11
  113. 3.3.9  Front Panel LED...................................................3-11
  114. 3.3.10  LA Enable Jumper.................................................3-12
  115. 3.3.11  Auxiliary Jumpers................................................3-12
  116. 3.3.12  BIOS Enable/Disable..............................................3-12
  117. 3.3.13  SCSI Terminators.................................................3-13
  118. 3.3.14  SCSI Terminator Power............................................3-13
  119. 3.4.1  Flexible Diskette Controller Secondary Address....................3-13
  120. 3.4.2  Flexible Diskette Controller Enable...............................3-13
  121. 3.4.3  Flexible Diskette Controller Interrupt Channel....................3-13
  122. 3.4.4  Flexible Diskette Controller DMA Request Channel..................3-14 
  123. 3.4.5  Flexible Diskette Controller DMA Acknowledge Channel..............3-14 
  124. 3.4  Flexible Diskette Controller Jumpers (AHA-1542A Only)...............3-13
  125.  
  126. 4.0  Hardware Functional Description.....................................4-1
  127. 4.1  Overview............................................................4-1
  128. 4.2 I/O  Port Interface..................................................4-1
  129. 4.2.1  Control and Status Port...........................................4-2
  130. 4.2.2  Command and Data Port.............................................4-4
  131. 4.2.3  Interrupt Flag Port...............................................4-5
  132. 4.3  Reset Overview......................................................4-7
  133. 4.3.1  Hard Reset Operations.............................................4-7
  134. 4.3.2  SCSI Reset Operations.............................................4-7
  135. 4.3.2.1  SCSI "Soft" Reset Option........................................4-8
  136. 4.3.2.2  SCSI "Hard" Reset Option........................................4-9 
  137.  
  138. 5.0   Firmware Functional Description....................................5-1
  139. 5.1  Host Adapter Command Overview.......................................5-1
  140. 5.1.1  Host Adapter Operation Codes......................................5-1
  141. 5.1.1.1  No Operation....................................................5-2
  142. 5.1.1.2  Mail Box Initialization.........................................5-2
  143. 5.1.1.3  Start SCSI Command..............................................5-3
  144. 5.1.1.4  Start PC/AT BIOS Command........................................5-3
  145. 5.1.1.5  Host Adapter Inquiry............................................5-3
  146. 5.1.1.6  Enable Mailbox Out Available Interrupt..........................5-4
  147. 5.1.1.7  Set Selection Time-out..........................................5-4
  148. 5.1.1.8  Set Bus-On Time.................................................5-5
  149. 5.1.1.9  Set Bus-Off Time................................................5-5
  150. 5.1.1.10  Set Transfer Speed    ............................................5-6
  151. 5.1.1.11  Return Installed Device........................................5-7
  152. 5.1.1.12  Return Configuration Data......................................5-8
  153. 5.1.1.13  Enable Target Mode Command.....................................5-8
  154. 5.1.1.14  Return Setup Data..............................................5-9
  155. 5.1.1.15  Write Adapter Channel 2 Buffer.................................5-11
  156. 5.1.1.16  Read Adapter Channel 2 Buffer..................................5-12
  157. 5.1.1.17  Write Adapter FIFO Buffer......................................5-12
  158. 5.1.1.18  Read Adapter FIFO Buffer.......................................5-12
  159. 5.1.1.19  Echo Command Data..............................................5-13
  160. 5.2  Mailbox Command Overview............................................5-13
  161. 5.2.1  Mailbox-Out Definition............................................5-14
  162. 5.2.2  Mailbox-In Definition.............................................5-15
  163. 5.3  Command Block Definition............................................5-19
  164. 5.3.1  Scatter Gather Definition.........................................5-25
  165. 5.4  Description of Operation............................................5-26
  166. 5.4.1  Execution of Initiator Mode Operations............................5-27
  167. 5.4.2  Execution of Target Mode Operations...............................5-28
  168. 5.4.2.1  Target Mode With a Prepared CCB.................................5-28
  169. 5.4.2.2  Target Mode Without a Prepared CCB..............................5-28
  170. 5.5  DMA Channel Initialization With the Host Adapter BIOS Disabled......5-29
  171. 5.6  Interrupt Initialization............................................5-29
  172.  
  173.  
  174. 6.0  Single-Threaded Software Interface..................................6-1
  175. 6.1  Single Threaded BIOS Command Interface..............................6-1
  176. 6.2  BIOS Command Execution Using Interrupt 13...........................6-2
  177. 6.2.1  Physical to Logical  Translation..................................6-2
  178. 6.2.2  BIOS Command Return Codes.........................................6-3
  179. 6.3  BIOS Disk Commands..................................................6-4
  180. 6.3.1  Reset Disk Subsystem..............................................6-5
  181. 6.3.2  Read Status of Last Operation.....................................6-5
  182. 6.3.3  Read Desired Sectors Into Memory..................................6-6
  183. 6.3.4  Write Desired Sectors From Memory.................................6-6
  184. 6.3.5  Verify Desired Sectors............................................6-6
  185. 6.3.6  Identify SCSI Devices.............................................6-7
  186. 6.3.7  Read Drive Parameters.............................................6-7
  187. 6.3.8  Initialize Drive Pair Characteristics.............................6-8
  188. 6.3.9  Seek..............................................................6-8
  189. 6.3.10  Alternate Disk Reset.............................................6-8
  190. 6.3.11  Test Drive Ready.................................................6-9
  191. 6.3.12  Recalibrate......................................................6-9
  192. 6.3.13  Read DASD Type...................................................6-9
  193.  
  194.  
  195. 7.0  Device Drivers......................................................7-1
  196. 7.1  PC/AT BIOS..........................................................7-1
  197. 7.1.1  Initialization....................................................7-1
  198. 7.1.2  System Boot.......................................................7-2
  199. 7.1.3  Hard Disk I/O.....................................................7-2
  200. 7.2  XENIX/UNIX..........................................................7-2
  201. 7.3  DOS Driver..........................................................7-2
  202. 7.3.1  DOS Driver Support of Virtual Mode................................7-3
  203. 7.4  AHA-1540 On-board Utilities.........................................7-4
  204.  
  205. 8.0  SCSI Features.......................................................8-1
  206. 8.1  SCSI Description Initiator Mode.....................................8-1
  207. 8.1.1  Linked SCSI Commands..............................................8-2
  208. 8.1.2  Zero Latency Read Operation.......................................8-2
  209. 8.1.3  SCSI Messages.....................................................8-3
  210. 8.2  SCSI Description, Target Mode.......................................8-3
  211. 8.2.1  Initiator Conformance Level Requirements..........................8-3
  212. 8.2.2  Support of Synchronous Transfer...................................8-3
  213. 8.2.3  SCSI Target Operation in Processor Target Mode....................8-4
  214. 8.2.3.1  Test Unit Ready.................................................8-5
  215. 8.2.3.2  Request Sense...................................................8-5
  216. 8.2.3.3  Inquiry.........................................................8-7
  217. 8.2.3.4  Send............................................................8-8
  218. 8.2.3.5  Receive.........................................................8-9
  219. 8.2.4 Incorrect Length Management........................................8-9
  220.  
  221. 9.0  Floppy Disk Interface...............................................9-1
  222.  
  223. 10.0  Problem Determination..............................................10-1
  224. 10.1  Self Diagnostic Capability.........................................10-1
  225. 10.2  Indicators.........................................................10-2
  226. 10.3  Problems Detected During Operation.................................10-2
  227. 10.3.1  HA Status Error Indications and Corrective Actions...............10-3
  228. 10.3.2  SCSI Error Indications and Corrective Actions....................10-5
  229. 10.4  Problems Detected During Installation..............................10-7 
  230.  
  231. 11.0  Glossary...........................................................11-1
  232.  
  233.  
  234. Appendix A  AHA-1540 System Timing Diagram................................A-1
  235. Appendix B  Connector Pin Out.............................................B-1
  236. Appendix C  Product Comparison and Compatibility..........................C-1 
  237.  
  238.  
  239. 1.1 DOCUMENT SCOPE 
  240.  
  241. This manual provides the information required to install and program the AHA-
  242. 1540A and the AHA-1542A  Intelligent Host Adapters in  AT bus-based systems. 
  243.  
  244. 1.2 PURPOSE 
  245.  
  246. The Adaptec AHA-1540A and AHA-1542A provide a powerful  multitasking interface 
  247. between the Industry Standard Architecture (PC/AT compatible) bus and the Small 
  248. Computer System Interface (SCSI) bus. The AHA-1540A/1542A are high performance 
  249. intelligent host adapters supporting a maximum asynchronous SCSI rate of 2.0 
  250. MBytes/second and a synchronous transfer rate of 5 MBytes/second. The AHA-
  251. 1540A/1542A support multithreaded I/O operations, allowing simultaneous 
  252. operations on multiple targets/LUNs. Disconnect/Reconnect support maximizes bus 
  253. utilization for multiple target systems. Target mode operation allow the AHA-
  254. 1540A and AHA-1542A to receive information from other host adapters. Scatter-
  255. gather allows high-performance even in systems with fragmented memory buffers. 
  256.  
  257. The Adaptec AHA-1540A/1542A provides a solution for system applications 
  258. requiring very high performance, configuration flexibility and multithreaded 
  259. I/O capability, and system redundancy. The Adaptec BIOS also allows the AHA-
  260. 1540A/1542A to be used in place of a standard hard disk controller.  The AHA-
  261. 1540A host adapter provides only the high performance host adapter circuitry. 
  262. The AHA-1542A host adapter provides identical host adapter circuitry, but adds 
  263. an IBM compatible flexible diskette controller to the circuit board. 
  264.  
  265. 1.3 AHA-1540A/1542A PRODUCT FEATURES 
  266.  
  267.     High performance Bus Master DMA with selectable or programmable data rates of 
  268.  up to 10 
  269.     MBytes/second. 
  270.     16- and 8-bit transfers     Odd and Even starting address 
  271.  transfers and odd or even data lengths 
  272.     Maximum synchronous SCSI transfer rate of up to 5.0 MBytes/second 
  273.     Asynchronous and synchronous peripherals supported simultaneously 
  274.     Programmable AT bus burst transfer on and off time 
  275.     Jumper selectable DMA channel for bus arbitration (channels 0,5,6,7) 
  276.     Jumper selectable interrupt channels (IRQ 9, 10, 11, 12, 14, 15) 
  277.     True multithreaded operation supporting up to 255 tasks simultaneously 
  278.     Programmable mailbox architecture Ñ    Adaptec BIOS for standard hard disk 
  279.  emulation 
  280.     Jumper selectable I/O port address 
  281.     Internal and external SCSI connectors 
  282.     Initiator and Target modes of operation fully supported 
  283.     On-board flexible diskette controller (AHA-1542A only) Ñ    Scatter-gather 
  284.  
  285. 1.4 PRODUCT SPECIFICATIONS
  286.  
  287.     Physical Dimensions: 
  288.      Length : 13.25 "  Width : 4.125"   Height : 0.5" 
  289.  Standard PC/AT¬ compatible form factor 
  290. Power Requirements:  
  291.      +5.0 +/- 0.25 Volts at 2.1 Amps maximum. 
  292. Environmental Requirements: 
  293.      Temperature 0-60 degrees C (operating or storage) 
  294. Reliability Information 
  295.      Mean Time Between Failures:    15000 hours             (calculated 
  296.   per Mil Handbook 217E, ground benign, 40 íC) 
  297.      Mean Time Between Failures:    TBD hours             (experimental) 
  298.      Mean Time to Repair:                30 minutes 
  299.      Industry Standard Architecture Interface 
  300. Standard PC/AT bus electronic and physical interface. 
  301.      Driver output: 
  302.  VOL: min:0 volts max.  0.4 volts IOL:    24 ma. 
  303.  VOH: min:2.4 volt max. 5.25 volts
  304.  IOH:  8 ma. 
  305. Receiver Input 
  306.  VIL: 0.8 volts 
  307.  VIH:    2.0 volts     
  308.  
  309. Connector configuration as specified by IBM PC/AT Technical Reference Manual or 
  310. manual of Industry Standard Architecture host computer. 
  311.  
  312.     SCSI Interface:
  313.  
  314. Electrical Interface: 
  315.  
  316.     As specified by ANSI X3.131-1986 for single-ended operation. 
  317.   Minimum driver output:48 milliamps, sinking @ 0.5 volts 
  318.   Signal true:min: 0 volts max:   0.8 volts 
  319.   Signal false:min:2.0 volts max:5.25 volts 
  320.   Input hysteresis:min: 0.2 volts     
  321. Terminator Power voltage: min:4.25 volts  max:5.25 volts 
  322. Terminator Power current: min:800 ma.  max:1.5 amp (fused) 
  323. Internal connector: Unshrouded 50-pin header, compatible with unshielded 
  324. alternative 1 connector as specified in ANSI X3.131-1986 
  325. Figure 4-1 For connector pin out, see Appendix B. Partial list of 
  326. compatible connector plugs (for reference only): Manufacturer Model Part Number 
  327. 3-M    N.A.    3425-6000 T&B Ansley    N.A.    609-5000M Molex    N.A.    15-29-8505 
  328.  
  329. Cable for internal SCSI connector should be good quality 50 conductor flat 
  330. cable with 26 or 28 gauge conductors and a characteristic impedance (Z0) of 100 
  331.  10. Cable shielding is necessary if extremely noisy circuitry or extremely 
  332. noise sensitive circuitry is present inside the host computer frame. 
  333.  
  334. External connector: 
  335. Shielded 50-pin connector as specified in ANSI X3.131-1986, Figure D-4. 
  336. For connector pin out, see Appendix B. 
  337. Partial list of compatible connector plugs or cable assemblies  (for reference 
  338. only):Manufacturer Model Part No. Amphenol N.A. 200-1M115-02003(Mates with 57-
  339. BC50B-AM200) AMP Champ Plug 554953-1 Cover 554946-x(1-2) Ferrule    554725-x(1-6) 
  340.  
  341. Cable for external SCSI connector should be good quality 100% shielded round 
  342. cable with 25 twisted pairs.  Each pair should have a characteristic impedance 
  343. (Z0) between 90 and 135 ╜. Wire gauge may be 26 or 28 AWG.  All pairs should 
  344. have the same impedance and should have the same delay per length of cable. 
  345. Cables meeting these requirements will normally operate correctly in any SCSI 
  346. configuration and should normally meet all FCC requirements. 
  347.     Floppy Disk Interface 
  348.   Standard Floppy Disk electronic and physical interface: 
  349.        Driver output:  VOL: min: 0 volts max. 0.5 volts
  350.                        IOL: 60 ma. 
  351.                        VOH: open collector  max. 5.25 volts 
  352.                        IOH:.1 ma. 
  353.  
  354.       Receiver Input 
  355. Tied to +5 volt supply through 150 ohm resistors. Schmidt Trigger with 0.8 
  356. volts hysteresis VT-:max 1.0 volts  VT+:        min    1.4 volts     
  357.  
  358. Connector: Unshrouded 34-pin header. For connector pin out, see Section 9.1 
  359. Partial list of compatible connector plugs (for reference only): 
  360. Manufacturer  Model  Part Number 
  361. 3-M           N.A.   3414-6000 
  362. T&B Ansley    N.A.   609-3400M 
  363. Cable for floppy connector should be good quality 34 conductor flat cable with 
  364. 28 gauge conductors. Addressing of the second drive may be generated by 
  365. twisting connector signals 10 through 16 or by changing jumpers in the floppy 
  366. disk drives. Meets radiation limits specified for a Class B computing device in 
  367. accordance with the specifications in Subpart J of Part 15 of FCC Rules. See 
  368. FCC Compliance notes and recommendations in preface of this document.
  369. 1.5 REFERENCE DOCUMENTS IBM PC/AT Technical Reference Manual 
  370.     Small Computer System 
  371. Interface, ANSI X3.131-1986, American National Standards Institute 
  372. Adaptec AHA-1540A/AHA-1542A Host Adapter Installation Guide 
  373. Adaptec AHA-1540 Programming Guide 
  374.  
  375.  
  376. 2.1 HARDWARE 
  377.  
  378.  
  379. 2.1.1 Bus Master DMA 
  380.  
  381. The AHA-1540A/1542A controls the host AT bus as a master and transfers data 
  382. directly to and from main system memory. This implementation is known as Bus 
  383. Master DMA. Bus Master DMA greatly reduces the host software overhead because 
  384. the host CPU is no longer required to maintain the DMA channel's address 
  385. pointers and word counts. Bus Master DMA also reduces the number of interrupts 
  386. generated per I/O command. The Adaptec AIC-560L is the DMA controller. 
  387. Adaptec's implementation of Bus Master DMA can achieve a 10 MB/second burst 
  388. data rate. This speed is especially valuable in multitasking systems where the 
  389. tasks execute on a time shared basis. Appendix A shows a diagram of the timing 
  390. required to achieve the DMA rates that are supported by the AHA-1540A/1542A. 
  391. The AHA-1540A/1542A DMA hardware will handle both odd-byte and odd-memory 
  392. address data transfers with no performance degradation. 
  393.  
  394. 2.1.2 SCSI Protocol Chip (AIC-6250) 
  395.  
  396. The AHA-1540A/1542A utilizes the AIC-6250 SCSI protocol chip to maximize the 
  397. SCSI bus utilization. The AIC-6250 is an Adaptec VLSI device which allows the 
  398. AHA-1540A/1542A to achieve greater than 2.0 MBytes/Sec asynchronous SCSI data 
  399. transfer rates, and up to 5.0 MBytes/second synchronous transfer rates. The 
  400. AIC-6250 will also enable the AHA-1540A/1542A to operate as both an initiator 
  401. and as a target device. Through a 16-bit host interface, the AIC-6250 reduces 
  402. bus busy time during data transfer by bursting data across the AT bus at up to 
  403. 10 MBytes/second. The AIC-6250 has separate data busses for the local 
  404. microprocessor and for the system data bus. This further increases the 
  405. performance of the AHA-1540A/1542A by reducing the overhead associated with 
  406. SCSI commands. 
  407.  
  408. 2.1.3  8 Bit Memory 
  409.  
  410. During normal DMA operations, nearly all transfers to and from memory are 16 
  411. bit transfers. At the very end, or the very beginning of an odd address 
  412. boundary, an 8 bit transfer on the upper data bits (D8-D15) will occur 
  413. according to the AT bus architecture. Some memory in the I/O space, such as 
  414. video RAM, is 8 bits only and always transfers data only on the lower data bits 
  415. (D0-D7). The AHA-1540A/1542A will transfer 16 bit or 8 bit memory in the 
  416. address space between 0A0000 hex and 0BFFFF hex depending on the signal line 
  417. MEM16 on the AT bus. If this signal is active, 16 bit memory is assumed, and if 
  418. inactive 8 bit memory is assumed. Outside of this address space 16 bit memory 
  419. is always assumed. 
  420.  
  421. 2.1.4 Hardware Block Diagram(cannot be included because of ASC transmission) 
  422.  
  423. BLOCK DIAGRAM OF AHA-1540A 
  424. BLOCK DIAGRAM OF AHA-1542A 
  425.  
  426. 2.2 FIRMWARE
  427.  
  428. The AHA-1540A/1542A supports multithreaded SCSI initiator operation through a 
  429. simple mailbox protocol. The firmware accepts as many Command Control Blocks 
  430. (CCB's) as required and executes them from its local RAM. The firmware controls 
  431. all of the SCSI activity that a task may require. This includes: Arbitration, 
  432. Selection, Disconnection, Reconnection, and Command completion. 
  433.  
  434. Using the same mailbox protocol, the AHA-1540A/1542A can operate as a Processor 
  435. type device serving as a multitasking target to other initiators. This feature 
  436. allows high bandwidth communication between multiple hosts. 
  437.  
  438. In addition, the AHA-1540A/1542A firmware cooperates with the BIOS installed on 
  439. the host adapter to emulate the standard DOS BIOS calls. This allows booting 
  440. operations and the execution of standard DOS operations from attached SCSI 
  441. disks, allowing the SCSI subsystem to completely replace the usual internal 
  442. disk functions. 
  443.  
  444. 2.2.1 Multithreaded Operation 
  445.  
  446. A multiuser, multitasking operating system issues a large number of I/O tasks 
  447. in a rapid sequence. The architecture of the AHA-1540A/1542A makes management 
  448. of this activity very easy and straight forward for the operating system and 
  449. its associated I/O drivers. This section briefly explains the interaction 
  450. between the system and the AHA-1540A/1542A required to accomplish an I/O task. 
  451.  
  452. 2.2.1.1 Mailboxes 
  453.  
  454. The AHA-1540A/1542A uses a mailbox architecture for task communication between 
  455. the host and host adapter. This allows the host adapter to perform 
  456. multithreaded operations with a minimum of host intervention.The mailboxes are 
  457. located in main system memory . Each mailbox entry is four bytes long. After 
  458. power up sequencing, host initialization procedures, and the boot procedure are 
  459. completed, the host issues an initialization command to inform the host adapter 
  460. of the mailbox location. There are always an equal number of Outgoing Mailboxes 
  461. (MBO) and Incoming Mailboxes (MBI). MBIs are located immediately after the 
  462. MBOs. A typical mailbox structure is shown below: 
  463. Base address 
  464.             +0-CMD----CCB 4 POINTER----MBO 0
  465.             +4-CMD----CCB 2 POINTER----MBO 1
  466.             +8-00-----FREE ENTRY-------MBO 2
  467.            +12-CMD----CCB 3 POINTER----MBO 3
  468.            +16-00-----FREE ENTRY-------MBI 0
  469.            +20-STATUS-CCB 1 POINTER----MBI 1
  470.            +24-00-----FREE ENTRY-------MBI 2
  471.            +28-00-----FREE ENTRY-------MBI 3
  472. In this example there are four MBOs and four MBIs. The first byte of each MBO 
  473. contains the MBO Command byte. The remaining three bytes point to a Command 
  474. Control Block (CCB). The CCB provides all the rest of the information needed to 
  475. complete a task. A MBO is available to accept a new entry if the first byte is 
  476. zero. 
  477.  
  478. The first byte of each MBI contains the status of a completed task. The 
  479. remaining three bytes point to the CCB of the completed task. An MBI is free if 
  480. the Status byte is zero. Mailboxes may point to CCB's controlling initiator 
  481. tasks, controlling target tasks, or controlling error recovery tasks. 
  482.  
  483. 2.2.1.2 Command Control Block 
  484.  
  485. A Command Control Block provides the information required to control a SCSI 
  486. command sequence. The block contains pointers to the data area to be used by 
  487. the command. It contains areas for presenting status of both the host adapter 
  488. and the addressed SCSI device. In addition, it contains the SCSI Command 
  489. Descriptor Block defining the action to be taken by the addressed SCSI device. 
  490. An error information buffer area is also provided. 
  491.  
  492. A Command Control Block is also used to service an operation requested by 
  493. another initiator when the AHA-1540A/1542A is being addressed as a SCSI 
  494. Processor device. 
  495.  
  496. The CCB is defined completely in Section 5. 
  497.  
  498. A typical CCB is shown below: 
  499.  
  500. 2.2.1.3 Command Descriptor Block 
  501.  
  502. The Command Descriptor Block (CDB), a part of the Command Control Block, is a 
  503. standard format command packet that is transmitted to the addressed SCSI 
  504. device. It contains all the command information required by the SCSI device to 
  505. perform the desired operation. The Command Descriptor Block contains the 
  506. command Operation Code followed by a Logical Unit Number (LUN), command 
  507. parameters if required, and a control byte. A typical Group 0 six byte CDB is 
  508. shown below:         BIT════════════════════════════════════════
  509.              BYTE  7     6     5     4     3     2     1     0
  510.               0    ├─O─P─E─R─A─T─I─O─N─────C──O──D──E───────────┤
  511.               1    ├L───U───N─────┤├─LOGICAL─BLOCK─ADDRESSS(MSB─┤
  512.               2    ├────────LOGICAL BLOCK ADDRESS───────────────┤
  513.               3    ├────────LOGICAL BLOCK ASDDRESS(LSB)─────────┤
  514.               4    ├────────TRANSFER LENTH──────────────────────┤
  515.               5    ├VENDOR┤├─────RESERVED───────────┤├FLAG┤├LINK┤
  516.  
  517. Please refer to the SCSI specification  ANSI X3.131, the Common Command Set 
  518. (CCS) revision 4B, and the SCSI 2 draft for additional information on Command 
  519. Descriptor Blocks. 
  520.  
  521. 2.2.1.4 Principles of Operation 
  522.  
  523. At power-up, the host must inform the host adapter of the location and number 
  524. of mailboxes. To start a task, the host builds a CCB and stores its memory 
  525. address into a free mailbox. A non-zero Mailbox Out command byte is then 
  526. written to indicate that the mailbox entry is full and valid. The host then 
  527. writes to an I/O port (defined in section 4) to indicate that the host adapter 
  528. should scan the MBO area. When a full MBO is found, the host adapter copies the 
  529. mailbox's CCB pointer into its internal RAM and clears the Mailbox entry by 
  530. writing a zero to the MBO command byte. This frees the MBO so that it can be 
  531. used to start another task. 
  532.  
  533. After completing a task, the host adapter scans the MBI area for a free 
  534. mailbox. When one is found, it is updated with the task's completion status and 
  535. CCB pointer. The CCB pointer identifies the completed task. A MBI Stored 
  536. interrupt is generated to notify the host that a task has been completed. The 
  537. host scans the MBI area searching for a non-zero Status byte. When one is 
  538. located, the host obtains the CCB pointer and frees the MBI by writing a zero 
  539. into the Status byte. The host then examines the contents of the CCB to 
  540. determine that the command was successfully completed. The freed MBI can now be 
  541. used to indicate the completion of another task. The host adapter fills the MBI 
  542. area and scans the MBO area in a round robin fashion. If the host saves the 
  543. position of the last active MBI entry, it can determine the MBI of a new entry 
  544. immediately without searching, since a new entry will be in the next MBI 
  545. location. 
  546.  
  547. The host adapter transmits a new MBO Available or MBI Full interrupt to the 
  548. host whenever all non-Mailbox interrupts have been cleared and serviced by the 
  549. host. The host should analyze the interrupts and clear them as soon as possible 
  550. so that the host adapter can post any new interrupts quickly. The host adapter 
  551. will not wait until an interrupt can be transmitted to the host before 
  552. processing an MBO entry or creating a new MBI entry. Thus, in processing a 
  553. single MBI interrupt, the host may find several MBI entries waiting by the time 
  554. the interrupt processing is finished. Similarly, a later MBI interrupt for the 
  555. last of the later MBI entries may find nothing to service because the MBI entry 
  556. was examined and processed as a result of the first MBI Full interrupt. If the 
  557. interrupts are reset quickly by the host, the probability of an interrupt 
  558. occurring when no MBI entry is available is much lower, providing an important 
  559. performance improvement. If the MBI entries are emptied by the host in a round-
  560. robin order, the scan for the next full entry is very simple, since it is 
  561. always the next MBI entry in the Mailbox area. 
  562.  
  563.  
  564. 2.2.1.5 Task Queueing 
  565.  
  566. Multiple tasks may be started against a target/LUN or against multiple 
  567. targets/Logical Units. Since only one task can be active against any one given 
  568. LUN at a time, all other tasks for the same LUN are queued. Other LUN's may 
  569. have active tasks at the same time. 
  570.  
  571. The host adapter dequeues on a first in, first out  (FIFO) basis for each 
  572. target/LUN combination. However, due to the optimization algorithm used by the 
  573. host adapter, a task may sometimes be started earlier in spite of it's late 
  574. entrance in the queue on multiple target/LUN systems. Task queueing should not 
  575. be used where changes in the order of command execution may cause data 
  576. integrity failures. 
  577.  
  578. 2.2.2 Single-Threaded Operation 
  579.  
  580. A host adapter BIOS is provided to emulate the standard  hard disk BIOS and 
  581. boot functions. With this BIOS, the host adapter can be used in lieu of a 
  582. standard hard disk controller on any ISA compatible system. 
  583.  
  584. The BIOS is compatible with the standard hard disk BIOS. This allows DOS to 
  585. access up to two hard disk devices on the SCSI bus without a driver. All normal 
  586. I/O functions are supported including system booting. Single threaded operation 
  587. and multithreaded operation do not operate simultaneously. Single threaded 
  588. operation cannot be requested until all multithreaded operations are completed. 
  589. Similarly, all multithreaded operations must be complete before a single 
  590. threaded operation can be requested. For most multitasking operating systems, 
  591. such as Xenix and OS/2, single threaded operation is normally used only for the 
  592. early part of the boot operation, after which multithreaded drivers take over 
  593. all control of the SCSI operations. 
  594.  
  595. 3.1 UNPACKING AND INSPECTION 
  596.  
  597. The carrier is responsible for damage incurred during shipment. In case of 
  598. damage, have the carrier note the damage on both the delivery receipt and the 
  599. freight bill, then notify your freight company representative so that the 
  600. necessary insurance claims can be initiated. 
  601.  
  602. After opening the shipping container, use the packing slip to verify receipt of 
  603. the individual items listed on the slip. Retain the  shipping container and 
  604. packing material for possible later reuse should return of the equipment to the 
  605. factory  necessary. 
  606.  
  607. CAUTION: The AHA-154XA is carefully designed to resist the effects of static 
  608. electricity. However, like all electronic equipment , it can be damaged or its 
  609. life can be shortened by unusual static discharges. Please take the proper 
  610. precautions when handling the board. Keep the board in its conductive wrapping 
  611. until it is ready to be installed in your system. Be sure that  the  host 
  612. computer and the personnel handling the board are properly grounded while 
  613. installing the board. 
  614.  
  615. 3.2 INSTALLATION 
  616.  
  617. The following section details the installation procedure for the Adaptec AHA-
  618. 1540A/1542A AT to SCSI host adapter. The installation of the board consists of 
  619. setting the various on-board jumpers, preparing the SCSI devices, installing 
  620. the correct terminations, inserting the board into a full-length AT compatible 
  621. connector, and connecting a SCSI cable from the on-board connector to a SCSI 
  622. target. 
  623.  
  624. NOTE: The system must be turned off during the installation procedure. 
  625.  
  626. 3.2.1 System Configuration 
  627.  
  628. The DOS operating system and the standard AT BIOS support two hard disk drives, 
  629. drive C: and drive D:. If two standard hard disk drives are installed, they are 
  630. the only hard disk drives accessible from the operating system. If one standard 
  631. hard disk drive is installed, the AHA-154XA BIOS allows DOS to access the SCSI 
  632. drive with the Target:LUN address of 0:0 as the second of the two supported 
  633. drives (drive D:). If no standard hard disk drives are installed, the AHA-154XA 
  634. BIOS allows DOS to access the SCSI drive with the address of 0:0 as the first 
  635. of two supported drives (drive C:) and the SCSI drive with the address of 0:1 
  636. or 1:0 as the second of the drives (drive D:). System booting is performed from 
  637. the floppy drive if a floppy diskette is installed. If no floppy is installed, 
  638. system booting is attempted from the drive chosen as drive C: through the above 
  639. process, whether the drive is a standard hard disk or a SCSI hard disk. The 
  640. AHA-154XA BIOS fully supports the extended partitioning capabilities of DOS 3.3 
  641. for up to two drives. The AHA-154XA BIOS only supports the AHA-154XA if its I/O 
  642. Port Address is set to 330h. 
  643.  
  644. Adaptec provides a special DOS driver for the AHA-154XA that allows the support 
  645. of up to 24 physical or logical devices under DOS. Many other operating 
  646. systems, including SCO Xenix and Unix, do not have this limitation and will 
  647. allow the access of any number of attached SCSI devices. 
  648.  
  649. The term "standard hard disk" refers to the disks attached to the system by a 
  650. standard ISA disk controller. These standard hard disks can be set to the 
  651. "Installed" or "Not Installed" state by the SETUP program that is supplied with 
  652. each ISA host computer. The SETUP program allows the user to select the number 
  653. of standard hard disks that are recognized by the system regardless of whether 
  654. or not they are physically installed. 
  655.  
  656.  
  657. 3.2.2 Hardware Setup 
  658.  
  659. Several preparatory steps must be taken to install the host adapter in the host 
  660. computer. The initialization jumpers must be correctly placed in the AHA154XA. 
  661. The SCSI Bus terminators must be installed in the correct SCSI devices. 
  662. Finally, the correct SCSI addresses must be assigned to each peripheral device. 
  663.  
  664. The Adaptec AHA-1540A/1542A 16-Bit AT bus to SCSI bus Host Adapter has been 
  665. designed to operate as shipped in the majority of AT class computers. The host 
  666. adapter's jumper settings should almost always remain in their original default 
  667. positions. Refer to section 3.3 if conflicting memory or port assignments 
  668. require that the host adapter jumpers be reconfigured. The AHA-1540A/1542A is 
  669. shipped with the following default settings: 
  670.  
  671.  SCSI Address-7   
  672.  SCSI Parity-Enabled 
  673.  Terminators-Installed 
  674.  Terminator Power-Supplying 
  675.  Synchronous Negotiation-Disabled
  676.  DMA Channel-5 
  677.  Interrupt Channel-11
  678.  AT Port Address-330H
  679.  AT BIOS Address-ODCOOOH
  680.  LA Enable Jumper-Installed 
  681.  
  682. Termination 
  683.  
  684. The SCSI bus must be terminated correctly to assure proper operation. The first 
  685. and last physical SCSI devices on the SCSI cable must have terminators 
  686. installed. All other SCSI devices must have terminators removed. The host 
  687. adapter is shipped with terminators already installed at locations RN3, RN4, 
  688. and RN5.   The internal and external connectors connect to the same SCSI bus, 
  689. so both internal and external cabling must be considered in determining where 
  690. terminators are installed. 
  691.  
  692. If only one cable (either internal or external) is connected to the host 
  693. adapter, the terminators must remain installed in the host adapter. Terminators 
  694. must also be installed on the device at the farthest end of the cable from the 
  695. host adapter. Terminators must be removed from all other attached SCSI devices. 
  696.  
  697. If both an internal and an external cable are connected to the host adapter, 
  698. remove the terminators on the host adapter and install terminators on the 
  699. devices at the farthest end of each cable. Terminators must be removed from all 
  700. devices except the device at the end of each cable. The instruction manuals for 
  701. each SCSI device will indicate how the terminators can be removed or replaced. 
  702.  
  703. Addressing 
  704.  
  705. The SCSI target address for each SCSI device to be attached must be selected by 
  706. setting the proper jumpers or switches on the device. If the SCSI device is a 
  707. hard disk that is to be used as the boot disk, it must have the Target 
  708. Identifier (SCSI Address) set to zero and the Logical Unit Number set to zero. 
  709. SCSI Addresses 0 and 1 should be reserved for SCSI hard disk drives.  SCSI 
  710. Address 2 is often used for tape devices. Each installed peripheral must have a 
  711. different Target Identifier. The host adapter's default address is 7. Duplicate 
  712. SCSI Addresses will cause errors that are extremely difficult to identify. Any 
  713. jumpers that control operating modes must also be properly set. If there is a 
  714. jumper that enables synchronous transfer negotiation, the jumper should be set 
  715. to enable negotiation. Check the SCSI drive or controller to ensure that Parity 
  716. Checking is enabled. If Parity checking on the device is disabled or not 
  717. supported, the jumper at location J8 of the host adapter should be removed. 
  718. Parity checking should only be enabled if all SCSI devices support it. 
  719.  
  720.  
  721. Installation Procedure 
  722.   
  723. Now that the host adapter and the devices to be installed have been properly 
  724. prepared, the devices should be installed in the following manner: 
  725.  
  726. 1) Turn OFF the power to the computer system. 
  727. 2) Remove the system cover according to the directions of the computer 
  728.    manufacturer. 
  729. 3) If only an external SCSI subsystem is to be used, no internal cabling is 
  730. required. If an internal SCSI peripheral is to be used, install a 50 pin SCSI 
  731. ribbon cable to the host adapter. This cable must be oriented correctly. Pin 1 
  732. of the SCSI cable is designated by a red stripe. Multi-color 50 pin ribbon 
  733. cables signify pin 1 with a brown color. Pin 1 on the host adapter 50 pin SCSI 
  734. header is located on the left hand side, farthest from the installation bracket 
  735. and is designated by the words PIN 1 on the board adjacent to the header. After 
  736. locating pin 1 on the host adapter and on the SCSI cable, carefully insert the 
  737. connector located at the end of the long end of the cable into the host adapter 
  738. connector. After ensuring that all pins are lined up and that the pin 1 
  739. orientation is correct, firmly seat the connector to the board. If it is ever 
  740. necessary to remove the cable, gentle prying with a small thin-bladed 
  741. screwdriver may be required. 
  742. 4) After installing the SCSI cable, the host adapter can be installed in any 
  743. one of the  adapter slots in the host computer. 
  744. 5) If an internal SCSI device is to be used, it should be installed in the 
  745. drive bays in accordance with the directions on the peripheral.  The proper 
  746. power supply must be connected to the SCSI peripheral device. 
  747. 6) The 50 pin SCSI ribbon cable can now be attached to each SCSI device. Refer 
  748. to the device's installation instructions to ensure proper pin 1 orientation. 
  749. Pin 1 orientation must be consistent throughout the system. Keep the ribbon 
  750. cable neatly dressed away from the ventilation slots in the computer system. 
  751. Keep the ribbon cable dressed away from possible electrical noise sources or 
  752. noise sensitive components, particularly large microprocessors, memory boards, 
  753. switching power supplies, and analog data acquisition boards. If the internal 
  754. configuration requires the cable to come near noise sensitive circuits , make 
  755. sure that the cable crosses the boards at right angles and is near the noise 
  756. sensitive circuits for the shortest distance possible. 
  757. 7) Carefully reinstall the cover of the computer. 
  758. 8) If an external SCSI subsystem is to be installed, it can now be cabled to 
  759. the External SCSI Connector projecting from the shielding bracket on the back 
  760. of the AHA-154XA Host Adapter. The proper shielded SCSI cable must be used for 
  761. proper operation. The external connector on the AHA-1540A/1542A is a D shell 
  762. connector that ensures correct pin 1 orientation on the host adapter. The 
  763. subsystem, cables, and SCSI terminators must be installed in accordance with 
  764. the directions provided with the external SCSI subsystem. The addresses 
  765. selected for external SCSI devices must not overlap with the addresses of the 
  766. host adapter or any other SCSI devices attached internally. 
  767.  
  768. 3.2.3 Checklist 
  769.  
  770. Before applying power to your system, the following items should be completed 
  771. and checked: 
  772.  
  773. 1. 50 pin SCSI ribbon cable is connected to the host adapter with proper pin 1 
  774. orientation. 
  775. 2. The host adapter is firmly seated in the host computer's adapter 
  776. slot. 
  777. 3. The correct SCSI addresses are selected on all attached SCSI devices. 
  778. Address 0 is reserved for the boot hard disk and address 1 is used for a second 
  779. hard disk. 
  780. 4. The correct operating modes are selected on all attached SCSI devices. 
  781. 5. Terminators are installed or removed on the drives and host adapter as 
  782. required. 
  783. 6. External SCSI devices are properly installed and cabled. 
  784.  
  785.  
  786. 3.2.4 Operation Using the BIOS Under DOS 
  787.  
  788. To bring up the system for the first time with the host adapter installed, 
  789. insert a bootable system diskette in drive A:, and close the door. After the 
  790. system initialization and power-up diagnostics have completed, system error 
  791. messages, such as "SYSTEM CONFIGURATION CHANGED, RUN SETUP" and prompts on how 
  792. to continue, may be displayed. After following the instructions displayed on 
  793. the screen, the system will boot from the flexible diskette drive. 
  794.  
  795. Run your SETUP program to configure the system as required. Remember that a 
  796. SCSI drive can only be used as a boot device if both standard hard disks are 
  797. mapped out. When the SETUP parameters have been defined, follow the directions 
  798. on the screen to re-initialize the system. 
  799.  
  800. Most SCSI drives are shipped from the factory with a complete low-level format. 
  801. A few SCSI drives and most bridge controllers, including the CCS compatible 
  802. Adaptec ACB-4525Z, require a low-level SCSI format operation before they will 
  803. operate. Section 7.4 describes how the low-level format utility that is 
  804. available in the Adaptec BIOS Utilities should be used to format such SCSI 
  805. devices. 
  806.  
  807. Run the DOS FDISK program to partition the disk for the number of cylinders to 
  808. be used by DOS. When using DOS 3.2 or under, it is generally a good idea to 
  809. select 1 less cylinder than the maximum allowable per partition according to 
  810. DOS. This eliminates the possibility of exceeding the 32 MB limit. Activate the 
  811. first DOS partition before leaving the FDISK program if it is to be the boot 
  812. partition. If you are not sure if a DOS partition exists, use the menu entry in 
  813. FDISK to display partition data. 
  814.  
  815. After the DOS partition has been created and activated, the drive is ready for 
  816. a DOS FORMAT. Refer to the DOS manual for the format options that are 
  817. available. If the system is going to boot from a SCSI disk, it is usually 
  818. easiest to transfer the hidden system files to that disk during the FORMAT. 
  819.  
  820. CAUTION: If the drive you are using was previously formatted or partitioned 
  821. with a different host adapter or disk controller, a DOS partition may already 
  822. exist. If such a partition does exist it should be deleted and re-created using 
  823. this host adapter. If this precaution is not followed, erratic system operation 
  824. may result. 
  825.  
  826. The host adapter and SCSI disks are now ready for normal operation. The host 
  827. adapter's BIOS performs the necessary initialization procedures during the boot 
  828. operation. This procedure is described in section 6.1.1 
  829.  
  830. 3.3 Jumper Configuration 
  831.  
  832. All of the jumpers have been preset at the factory to ensure proper system 
  833. operation with the majority of AT bus systems. This  information is provided to 
  834. help the OEM or system integrator to configure the system properly if other 
  835. option boards present conflicts. 
  836.  
  837. The following diagram shows the approximate location of the various customer 
  838. configurable items on the AHA-1540A/1542A. Listed after the diagram are the 
  839. functions, defaults, and set-up options for each jumper. 
  840.  
  841. Jumper locations:┌─────────────────────────────────────────────────────┬──
  842.                  │    j5    j4                       ├scsi conn.┤      │
  843.                  └──┐     ├diskette header┤                            ├──┐
  844.                     │                                 j6    j7         │  │
  845.                     │                                           j10    │  │
  846.                     │                                                  │  │
  847.                     │      j9                        j8   j12          │  │
  848.                     │          j11                           j18       │  │
  849.                     │ j13             j14j15 j16    j17      j19       ├──┘
  850.                     └──────────────────────────┐     ┌─┐          ┌────┘
  851.                                                └─────┘ └──────────┘
  852. 3.3.1  Jumper Block J1
  853. Jumper block J1 is shown below: 
  854.               ┌─────┐
  855.       pin 1═  │ 0 0 │ Syncronous transfer
  856.               │ 0 0 │ Diagnostics
  857.               │ 0 0 │ SCSI parity                             
  858.               │ 0 0 │ SCSI address
  859.               │ 0 0 │ SCSI address
  860.               │ 0 0 │ SCSI address
  861.               │ 0 0 │ DMA channel────────────┐ j14 and j15 must also be set.
  862.               │ 0 0 │ DMA channel────────────┘
  863.               │ 0 0 │ Interrupt channel──────┐
  864.               │ 0 0 │ Interrupt channel      ├──j16 must also be set.
  865.               │ 0 0 │ Interrupt channel──────┘
  866.               │ 0 0 │ DMA transfer speed
  867.               │ 0 0 │ DMA transfer speed           x= jumper installed
  868.               └─────┘
  869. Jumper block J1 is the large vertically oriented block of jumpers located near 
  870. the center of the host adapter. Pin pair 1 is the topmost pair of pins. 
  871.  
  872. 3.3.1.1 SCSI Synchronous Negotiation 
  873.  
  874. Pin-pair 1 of jumper block J1 is the synchronous negotiation enable jumper. The 
  875. AHA-1540A/1542A will initiate SCSI synchronous negotiation during 
  876. initialization, or after a SCSI reset if this jumper is installed. If the 
  877. jumper is not installed, the AHA-1540A/1542A will still support synchronous 
  878. SCSI transfers, but a different SCSI device must initiate the negotiation. 
  879. Default is jumper removed, synchronous negotiation initiation disabled. If any 
  880. attached SCSI devices support synchronous transfer, the initiation of 
  881. negotiation should be enabled by both the AHA-154XA and the attached devices to 
  882. fully implement the SCSI synchronous negotiation protocol. 
  883.  
  884. 3.3.1.2 Diagnostic Jumper 
  885.  
  886. Pin-pair 2 of jumper block J1 is a factory diagnostic jumper. This jumper is 
  887. reserved for Adaptec use and must not have a jumper shunt installed. If this 
  888. jumper is installed, the firmware will loop through the power on diagnostics, 
  889. preventing normal operation. Default is jumper removed. 
  890.  
  891. 3.3.1.3 SCSI Parity 
  892.  
  893. Pin-pair 3 of jumper block J1 is the parity enable/disable jumper. The SCSI 
  894. parity checking is disabled if this jumper is installed. The default is parity 
  895. checking enabled. 
  896.  
  897. 3.3.2 SCSI Address
  898.  
  899. Pin-pairs 4, 5, and 6 of jumper block J1 define the SCSI address. The SCSI 
  900. address is selected according to the following table. The default address is 7. 
  901.       J1      ┌─────┐
  902.       pin 1═  │ 0 0 │                        pin pair  scsi
  903.               │ 0 0 │                        4 5 6     address     
  904.               │ 0 0 │                        0 0 0       7      default
  905.    pin-pair 4 │ 0 0 │ SCSI address─0         x 0 0       6
  906.    pin-pair 5 │ 0 0 │ SCSI address─1         0 x 0       5
  907.    pin-pair 6 │ 0 0 │ SCSI address─2         x x 0       4
  908.               │ 0 0 │                        0 0 x       3
  909.               │ 0 0 │                        x 0 x       2
  910.               │ 0 0 │                        0 x x       1
  911.               │ 0 0 │                        x x x       0
  912.               │ 0 0 │ 
  913.               │ 0 0 │ 
  914.               │ 0 0 │ 
  915.               └─────┘    x=jumper installed
  916.           
  917. 3.3.3 DMA Channel 
  918.  
  919. There are three jumper blocks involved in selecting the DMA channel. These are 
  920. J1, J14, and J15. The DMA channel selection jumpers consist of pin pairs 7 and 
  921. 8 located in the large block of jumper pins J1. The DMA channel reported to the 
  922. AT during the Return Configuration command is set by these jumpers according to 
  923. the following table. Default is DMA channel 5. 
  924.  
  925. Jumper set J14 selects the DMA REQ signal to be used by the AHA-1540A/1542A 
  926. according to the following table. This jumper set is located near the bottom 
  927. center of the host adapter. Pin pair 1 is the right most pair of pins. The 
  928. default is DMA Request 5. 
  929.  
  930. Jumper  set J15 selects the DMA ACK signal to be used by the AHA-1540A/1542A 
  931. according to the following table. This jumper set is located near the bottom 
  932. center of the host adapter. Pin pair 1 is the right most set of pins. The 
  933. default is DMA Acknowledge 5.     
  934.  
  935. There are four DMA channels that may be chosen for use by the AHA-1540A/AHA-
  936. 1542A, channels 0, 5, 6, and 7. The DMA channel is set up by using the three 
  937. jumper blocks and pin-pairs previously described. The jumper settings for each 
  938. channel are shown below:      ┌───────────────────────┐
  939.            ┌─────┐            │j1 DMA channel jumpers │
  940.    pin 1═  │ 0 0 │            │pin-pair  DMA          │
  941.            │ 0 0 │            │ 7 8      channel      │
  942.            │ 0 0 │            │ 0 0        7          │
  943.            │ 0 0 │            │ x 0        6          │
  944.            │ 0 0 │            │ 0 x        5          │
  945.            │ 0 0 │            │ x x        0          │
  946. pin-pair 7 │ 0 0 │ DMA channel└───────────────────────┘
  947. pin pair 8 │ 0 0 │ DMA channel  
  948.            │ 0 0 │ ┌──────────────────────┐    ┌──────────────────────┐
  949.            │ 0 0 │ │ j14-2                │    │ j15-2                │
  950.            │ 0 0 │ │ 0 0 x 0──pin 1       │    │ 0 0 x 0──pin 1       │
  951.            │ 0 0 │ │ 0 0 x 0              │    │ 0 0 x 0              │
  952.            │ 0 0 │ │ │ │ │ └───channel 0  │    │ │ │ │ └───channel 0  │
  953.            └─────┘ │ │ │ └─────channel 5  │    │ │ │ └─────channel 5  │
  954.                    │ │ └───────channel 6  │    │ │ └───────channel 6  │
  955. x=jumper installed │ └─────────channle 7  │    │ └─────────channle 7  │
  956.                    └──────────────────────┘    └──────────────────────┘
  957. 3.3.4 AT Interrupt Channel
  958.  
  959. There are two jumper blocks involved in selecting the AT interrupt channel. 
  960. These are J1 and J16. The AT interrupt channel jumpers consist of pin pairs 9, 
  961. 10, and 11 in the large block of jumper pin pairs J1. The interrupt channel 
  962. reported to the AT during the Return Configuration Command is set by these 
  963. jumpers according to the following table. The default is interrupt channel 11. 
  964.  
  965. Jumper set J16 selects the AT interrupt channel to be used by the AHA-
  966. 1540A/1542A. This jumper set is located near the bottom center of the host 
  967. adapter. Pin pair 1 is the right most pair of pins. The interrupt channel used 
  968. is set according to the following table. The default interrupt channel is 11. 
  969.                                      ┌───────────────────────┐
  970.    j1      ┌─────┐                   │ j1 interrupt channels │
  971.    pin 1═  │ 0 0 │                   │ pin-pair    interrupt │
  972.            │ 0 0 │                   │ 9 10  11   channel    │
  973.            │ 0 0 │                   │ 0  0   0       9      │  
  974.            │ 0 0 │                   │ x  0   0       10     │
  975.            │ 0 0 │                   │ 0  x   0       11     │
  976.            │ 0 0 │                   │ x  x   0       12     │
  977.            │ 0 0 │                   │ 0  0   x       14     │
  978.            │ 0 0 │                   │ x  0   x       15     │
  979. pin-pair 9 │ 0 0 │ Interrupt channel └───────────────────────┘
  980. pin-pair 10│ 0 0 │ Interrupt channel     ┌────────────────────┐
  981. pin pair 11│ 0 0 │ Interrupt channel     │ j16   3            │
  982.            │ 0 0 │                       │ 0 0 0 x 0 0──pin 1 │
  983.            │ 0 0 │ x=jumper installed    │ 0 0 0 x 0 0        │
  984.            └─────┘                       │ │ │ │ │ │ └──IRQ 9 │
  985.                                          │ │ │ │ │ └────IRQ 10│
  986.                                          │ │ │ │ └──────IRQ 11│
  987.                                          │ │ │ └────────IRQ 12│  
  988.                                          │ │ └──────────IRQ 14│
  989.                                          │ └────────────IRQ 15│
  990.                                          └────────────────────┘
  991. 3.3.5 DMA Transfer Speed Default
  992.  
  993. Pin-pairs 12 and 13 of jumper block J1 set the default DMA transfer speed. 
  994. Installing jumper shunts as shown below will set any of 4  default DMA transfer 
  995. speeds. (See Appendix A for system timing requirements.) The default speed is 
  996. selected after power on or after a hard reset occurs. This speed may also be 
  997. tuned to allow for the fastest possible transfer (minimum bus on time) for any 
  998. particular system by using the Host Adapter command Set Transfer Speed. The 
  999. Host Adapter Command overrides the jumper settings. This command is detailed in 
  1000. section 5. The default is no jumper installed. 
  1001.       J1      ┌─────┐                      ┌─────────────────┐ 
  1002.       pin 1═  │ 0 0 │                      │ pin pair   DMA  │ 
  1003.               │ 0 0 │                      │ 12  13     Speed│    
  1004.               │ 0 0 │                      │  0   0      5.0 │ default
  1005.               │ 0 0 │                      │  X   0      5.7 │ 
  1006.               │ 0 0 │                      │  0   X      6.7 │ 
  1007.               │ 0 0 │                      │  X   X      8.0 │ 
  1008.               │ 0 0 │                      └─────────────────┘ 
  1009.               │ 0 0 │                       
  1010.               │ 0 0 │                       
  1011.               │ 0 0 │                      
  1012.               │ 0 0 │ 
  1013.    pin-pair 12│ 0 0 │DMA Transfer speed
  1014.    pin-pair 13│ 0 0 │DMA Transfer speed 
  1015.               └─────┘                        x=jumper installed
  1016.  
  1017. 3.3.6 AT BIOS Wait State 
  1018.  
  1019. Jumper block J7 allows IOCHRDY on the AT bus to be driven not active during 
  1020. BIOS reads. The time may be set to 100ns, 200ns, 300ns, or the function may be 
  1021. disabled. The default is Wait State Disabled. 
  1022.  
  1023.                     ┌J7─────┐
  1024.                     │0 0 0 X│pin 1
  1025.                     │0 0 0 X│
  1026. x=jumper installed  └┼─┼─┼ └─────disable wait states          
  1027.                      │ │ └────────100 ns
  1028.                      │ └──────────200 ns
  1029.                      └────────────300 ns
  1030.  
  1031. 3.3.7 AT Port Address
  1032.  
  1033. The starting address of the block of four I/O ports required by the AHA-
  1034. 1540A/1542A is selected by the jumpers in jumper block J6. Pin pair 1 is the 
  1035. right most pair of pins. The default address is 0330H. That port address is 
  1036. required by the BIOS. Other valid port addresses are 334H, 330H, 234H, 230H, 
  1037. 134H, and 130. These port addresses may be used by device drivers and operating 
  1038. systems that support multiple host adapters.  The default address is 330H. 
  1039.   ┌J6───┐                 AT Port Address
  1040.   │0 0 X│pin 1            A9  A8  A2   ADRESS
  1041.   │0 0 X│                  0   0   0    334H
  1042.   └┼─┼ └───A2              0   0   X    330H
  1043.    │ └─────A8              0   X   0    234H
  1044.    └───────A9              0   X   X    230H
  1045.  x=jumper installed        X   0   0    134H
  1046.                            X   0   X    130H
  1047.  
  1048. 3.3.8 AT BIOS Address 
  1049.      ┌─────┐                  BIOS Address
  1050.  J10 │ 0  0│                  Jumpers   BIOS 
  1051.      │ 0  0│──Pin 1            0   1    ADRESS
  1052.      └─│──│┘                   0   0    0DC000H  DEFAULT ADDRESS
  1053.        │  └──BIOS Address 0    X   0    0CC000H
  1054.        └──────BIOS Address 1   0   X    0D8000H
  1055.  x=jumper installed            X   X    OC8000H
  1056.  
  1057. The starting address of the block of address space reserved for the Adaptec 
  1058. BIOS is selected by the jumper pins located in J10. The default address is 
  1059. ODCOOOH. This address must not conflict with any other BIOS or decoded address 
  1060. space in the system. 
  1061.  
  1062. 3.3.9 Front Panel LED Connector 
  1063.  
  1064.     J5 ┌───────────┐
  1065.        │0  0  0  0 │─PIN 1
  1066.        └───────────┘
  1067.  
  1068. J5 is the front panel LED header. Pins 1 and 4 are connected to the same 220 
  1069. ohm pull up resistor and pins 2 and 3 are pulled low by the same LED driver 
  1070. whenever the on board LED is on. This allows the Front Panel LED cable to be 
  1071. plugged in with either orientation. The driver is specified to pull 24 
  1072. milliamps through the LED. J5 is located near the top left of the host adapter. 
  1073.  
  1074. 3.3.10 LA Enable Jumper (AHA-W1542A Only)
  1075.  
  1076. Note: This jumper exists only on the early production units. These are easily 
  1077. identified by a label on the board that has a model number of AHA-W1542A. 
  1078. Standard production AHA-1540A and AHA-1542A boards do not have this jumper. 
  1079.  
  1080. When J8 is installed, address drivers LA17 - LA19 are enabled. When not 
  1081. installed these address lines are not driven. Some computers, especially 80386 
  1082. based machines, short address lines LA17 and SA17, LA18 and SA18, and LA19 and 
  1083. SA19 together. If your computer system shorts these lines then remove jumper 
  1084. J8. Default is jumper installed. 
  1085.  
  1086. CAUTION:   Incorrect installation of this jumper may not result in immediate 
  1087. system problems. If it is necessary to change the state of this jumper after 
  1088. the system has been configured, the SCSI hard disk must also be re-formatted. 
  1089. Contact the computer system manufacturer if there is any doubt on how the 
  1090. system implements these address lines. 
  1091.  
  1092. 3.3.11 Auxiliary Jumpers 
  1093.  
  1094. Installation of a jumper shunt on pin pair 4 of jumper block J9 will disable 
  1095. the automatic request sense function on the AHA-1540A/1542A. If the automatic 
  1096. Request Sense function is enabled, it may additionally be disabled on a command 
  1097. by command basis using the Request Sense Allocation Length Field of the CCB 
  1098. (see Section 5.3). All other pins-pairs on jumper block J9 are reserved for 
  1099. future use. 
  1100.        1        4
  1101.       ┌──────────┐
  1102.    J9 │0  0  0  0│
  1103.       │0  0  0  0│
  1104.       └│──│──│──│┘
  1105.        │  │  │  └──DISABLE AUTO SENSE
  1106.        │  │  └─────RESERVED
  1107.        │  └────────RESERVED
  1108.        └───────────RESERVED
  1109. 3.3.12 BIOS Enable/Disable 
  1110.  
  1111. Only one host adapter BIOS should be enabled in any host system. That BIOS 
  1112. allows DOS to access up to two SCSI drives on the host adapter having a port 
  1113. address of 330H. Any other host adapters installed in the system must have 
  1114. their BIOS disabled.  In addition, certain operating systems may require that 
  1115. the BIOS be disabled. The enabling of the BIOS is controlled by jumper J11, 
  1116. near the bottom left of the host adapter. When the jumper is installed on J11 
  1117. the BIOS is enabled. When the jumper is removed, the BIOS is disabled and will 
  1118. not respond to host reads. The default is jumper installed. 
  1119.  
  1120. 3.3.13 SCSI Terminators
  1121.  
  1122. RN3, RN4, and RN5 are the SCSI terminators. If the AHA-1540A/1542A is not the 
  1123. first or the last SCSI device in a string of SCSI devices, or if in-line 
  1124. terminators are used, then all of these resistor networks must be removed.  
  1125. More information is provided in section 3.2.2 about the proper use of the SCSI 
  1126. terminators. The default is terminators installed. 
  1127.  
  1128. 3.3.14 SCSI Terminator Power 
  1129.  
  1130. Fuse F1 controls the terminator power. If another SCSI device is supplying 
  1131. terminator power, then F1 may optionally be removed. No more than 5 SCSI 
  1132. devices should be configured to supply terminator power to a single SCSI bus. 
  1133. The default is F1 installed with the AHA-1540A/1542A supplying terminator 
  1134. power. The terminator power is protected with a 1.5 amp fuse to prevent short 
  1135. circuits from burning SCSI cables. The terminator power is additionally 
  1136. protected from terminator power back-flow with a low voltage-drop diode so that 
  1137. the SCSI bus will continue to operate even if one or more SCSI host adapters is 
  1138. powered down. 
  1139.  
  1140. 3.4 Flexible Diskette Controller Configuration Jumpers (AHA-1542A Only) 
  1141.  
  1142. 3.4.1 Flexible Diskette Controller Secondary Address 
  1143.  
  1144. Jumper J12, located near the center right of the host adapter, controls the 
  1145. selection of the flexible diskette controller secondary address. When J12 is 
  1146. installed, the flexible diskette controller will respond to I/O addresses 370-
  1147. 377. When not installed, the flexible diskette controller will respond to I/O 
  1148. addresses 3F0-3F7. The default is no jumper installed.     
  1149.  
  1150. 3.4.2 Flexible Diskette Controller Enable     Jumper J13, located near the bottom 
  1151. left of the host adapter, enables or disables the flexible diskette controller. 
  1152. When this jumper is installed, the flexible diskette controller will respond to 
  1153. host reads and writes. When not installed, the flexible diskette controller 
  1154. will not respond to any signal. The default is jumper installed. 
  1155.  
  1156. 3.4.3 Flexible Diskette Controller Interrupt Channel 
  1157. INTERRUPT CHANNEL 6
  1158.      ┌───────┐                        ┌───────┐                   
  1159.  J17 │0  X  X│─PIN 1             J17  │X  X  0│─PIN 1
  1160.      └───────┘                        └───────┘
  1161.      
  1162. Jumper block J17, located near the bottom right of the host adapter, sets the 
  1163. interrupt channel for the flexible diskette controller. The default is 
  1164. interrupt channel 6. 
  1165.  
  1166. 3.4.4 Flexible Diskette Controller DMA Request Channel
  1167. DMA REQ CHANNEL 2                DMA REQ CHANNEL 3
  1168.      ┌───────┐                        ┌───────┐                   
  1169.  J18 │0  X  X│─PIN 1             J17  │X  X  0│─PIN 1
  1170.      └───────┘                        └───────┘
  1171.  
  1172. Jumper J18, located near the bottom right of the host adapter, selects the DMA 
  1173. Request channel for the flexible diskette controller. Jumper J19, the DMA 
  1174. Acknowledge jumper, must be set to the same position. Default is DMA channel 2. 
  1175.  
  1176. 3.4.5 Flexible Diskette Controller DMA Acknowledge Channel 
  1177. DMA ACK CHANNEL 2                DMA ACK CHANNEL 3
  1178.      ┌───────┐                        ┌───────┐                   
  1179.  J19 │0  X  X│─PIN 1             J19  │X  X  0│─PIN 1
  1180.      └───────┘                        └───────┘
  1181.  
  1182. Jumper J19, located near the bottom right of the host adapter, selects the DMA 
  1183. acknowledge channel for the flexible diskette controller. Jumper J18, the DMA 
  1184. Request jumper, must be set to the same position. Default is DMA channel 2. 
  1185.  
  1186. 4.0 HARDWARE FUNCTIONAL DESCRIPTION 
  1187.  
  1188. 4.1 HARDWARE OVERVIEW 
  1189.  
  1190. This section provides a description of the AHA-1540A/1542A hardware functional 
  1191. interface to the PC/AT host software. 
  1192.  
  1193. The hardware consists of a custom SCSI protocol chip, the AIC-6250, a FIFO 
  1194. buffer, a set of I/O ports, and a controlling microprocessor. 
  1195.  
  1196. The DMA control logic on the host adapter controls the AT bus arbitration and 
  1197. data transfer hand shaking. During DMA data transfers, the AHA-1540A/1542A 
  1198. becomes a bus master. The DMA logic supports both odd and even starting 
  1199. addresses. For odd starting addresses, the first transfer will be an 8-bit 
  1200. transfer. Thereafter, 16 bit transfers will be used to complete the data 
  1201. transfer. Odd-byte transfers, and the the last transfer of an even number of 
  1202. bytes to an odd address are treated in a similar manner. 
  1203.  
  1204. The SCSI port is controlled by the AIC-6250, an Adaptec SCSI protocol device 
  1205. which supports arbitration, selection, and reselection with a minimum of 
  1206. processor intervention. This VSLI device also supports target mode and 
  1207. synchronous SCSI transfers. 
  1208.  
  1209.  
  1210. 4.2 I/O PORT INTERFACE 
  1211.  
  1212. The I/O port interface consists of three address locations. These three port 
  1213. addresses are decoded in the AT I/O address space. They form the primary 
  1214. communications channel between the host and the host adapter. The I/O ports are 
  1215. 8 bits wide. The base port is for control and status, the second port for 
  1216. command and data transfer, and the third port for interrupt flags. 
  1217.  
  1218. I/O PORT INTERFACE BIT DEFINITION 
  1219.  
  1220.  
  1221. PORT ADDRESS = BASE + 0 
  1222.  
  1223. WRITE:  Control Register        READ:   Status Register 
  1224.  
  1225. Bit 7 Hard Reset (HRST)         Bit 7 Self Test in Progress (STST) 
  1226. Bit 6 Soft Reset (SRST)         Bit 6 Internal Diagnostic Failure (DIAGF) 
  1227. Bit 5 Interrupt Reset (IRST)    Bit 5 Mailbox Initialization Required (INIT)
  1228. Bit 4 SCSI Bus Reset (SCRST)    Bit 4 SCSI Host Adapter Idle (IDLE)
  1229. Bit 3 Reserved  (0)             Bit 3 Command/Data Out Port Full(CDF)
  1230. Bit 2 Reserved  (0)             Bit 2 Data In Port Full (DF)
  1231. Bit 1 Reserved  (0)             Bit 1 Reserved ( Undefined )
  1232. Bit 0 Reserved  (0)             Bit 0 Invalid H A  Command (INVDCMD) 
  1233.  
  1234. PORT ADDRESS = BASE + 1
  1235.  
  1236. WRITE:  Command / Data Out       READ:  Data In 
  1237. Bit 7 Command/Data Out Bit 7     Bit 7 Data In Bit 7 
  1238. Bit 6           "      Bit 6     Bit 6     "   Bit 6
  1239. Bit 5           "      Bit 5     Bit 5     "   Bit 5
  1240. Bit 4           "      Bit 4     Bit 4     "   Bit 4
  1241. Bit 3           "      Bit 3     Bit 3     "   Bit 3
  1242. Bit 2           "      Bit 2     Bit 2     "   Bit 2
  1243. Bit 1           "      Bit 1     Bit 1     "   Bit 1
  1244. Bit 0           "      Bit 0     Bit 0     "   Bit 0 
  1245.  
  1246. PORT ADDRESS = BASE + 2 
  1247.  
  1248. WRITE:  Reserved, do not write            READ:    Interrupt Flags 
  1249.  
  1250. Bit 7                            Bit 7 Any Interrupt 
  1251. Bit 6                            Bit 6 Reserved 
  1252. Bit 5                            Bit 5 Reserved
  1253. Bit 4                            Bit 4 Reserved
  1254. Bit 3                            Bit 3 SCSI Reset Detected (SCRD)
  1255. Bit 2                            Bit 2 HA Command Complete (HACC)
  1256. Bit 1                            Bit 1 MBO Empty (MBOA)
  1257. Bit 0                            Bit 0 MBI Full (MBIF) 
  1258.  
  1259.  
  1260. 4.2.1 Control and Status Port 
  1261.  
  1262. Writing a one to the bits of the Control Port initiates certain special host 
  1263. adapter operations.   There is no requirement to return the bits to the zero 
  1264. state, since they are reset automatically after the requested operation is 
  1265. initiated. Read operations to the Status port address return host adapter 
  1266. status information. 
  1267.  
  1268. Base+0 Port, Write:  Host Adapter Control Port. 
  1269.  
  1270. Bit 7-Hard Reset  (HRST): The setting of the Hard Reset bit to one forces the 
  1271. host adapter into a state identical to a normal power on state. Diagnostic 
  1272. functions are executed and all status for ongoing SCSI operations is lost. A 
  1273. Reset Condition is generated on the SCSI bus. While the reset is being 
  1274. processed, the Self Testing in Progress bit (Host Adapter Status Port bit 7) is 
  1275. set. When the reset is complete, that bit is reset and the Mailbox 
  1276. Initialization Required bit (Host Adapter Status Port bit 5) and the SCSI Host 
  1277. Adapter Idle bit (Host Adapter Status Port bit 4) are set, indicating that the 
  1278. AHA-154XA mailbox structure must be re-initialized and that no other operations 
  1279. are active on the host adapter. See section 4.3, describing the overall reset 
  1280. structure. 
  1281.  
  1282. Bit 6-Soft Reset (SRST): The Soft Reset bit clears all ongoing SCSI and host 
  1283. adapter commands. All Command Control Blocks are abandoned and all queued 
  1284. commands are abandoned. Mailbox In and Mailbox Out entries must be cleared by 
  1285. the host. No diagnostic functions are executed. No Reset Condition is generated 
  1286. on the SCSI bus.  The Mailbox Initialization Required bit (Host Adapter Status 
  1287. Port bit 5) and the SCSI Host Adapter Idle bit (Host Adapter Status Port bit 4) 
  1288. are set when the reset processing is completed. This indicates that the AHA-
  1289. 154XA Mailbox structure must be re-initialized and that no other operations are 
  1290. active on the Host Adapter. See section 4.3, describing the overall reset 
  1291. structure. 
  1292.  
  1293. Bit 5-Interrupt Reset (IRST): The setting of this bit clears the interrupt port 
  1294. of all bits that have been set and resets the interrupt line. The host adapter 
  1295. manages the interrupt presentation to minimize the possibility of incorrectly 
  1296. resetting an interrupt. MBOE and MBIF interrupts are presented immediately 
  1297. unless an SCRD or HACC interrupt has not yet been cleared. An SCRD or HACC will 
  1298. only be presented after any interrupt bit has been cleared and DF is zero, 
  1299. indicating an operation is fully completed. The prompt resetting of MBOE and 
  1300. MBIF interrupts minimizes the chance of a reset of one also resetting the 
  1301. other. Host programs should, however, be aware that there is a small chance of 
  1302. falsely resetting a new MBIF reset while clearing an MBOE interrupt. This can 
  1303. be resolved by periodically scanning the MBI entries when activity is expected 
  1304. on the host adapter or by not enabling the MBOE interrupt. 
  1305.  
  1306. Bit 4-SCSI Bus Reset (SCRST):The setting of this bit causes a SCSI Bus Reset to 
  1307. be generated on the SCSI bus. The SCSI Bus Reset is triggered at the time the 
  1308. SCRST bit is set to one and raises the RST line on the SCSI Bus for the 
  1309. architected 25 microsecond period. The reset is managed as a SCSI Soft Reset 
  1310. and will allow partially completed operations to continue after the reset 
  1311. occurs. See section 4.3, describing the overall reset structure. 
  1312.  
  1313. Bits 0-3 -Reserved: Reserved bits must be set to zero to avoid compatibility 
  1314. problems with future extensions of the Control Register. 
  1315.  
  1316.  
  1317. Base+0 Port, Read: Host Adapter Status Port 
  1318.  
  1319. Bit 7-Self Testing in progress (STST): This bit, when one, indicates that the 
  1320. host adapter is performing self-initialization and internal diagnostics. The 
  1321. bit is asserted after a power-on or hard reset (Control Port Bit 7 HRST = 1). 
  1322. When diagnostic operation is complete,  the STST bit is set to zero and bit 5 
  1323. or bit 6 is set to indicate the successful or unsuccessful completion of the 
  1324. diagnostics. If bit 7 remains on, it indicates that the initialization or 
  1325. diagnostic could not be completed. The error condition can be determined as 
  1326. described in section 10. In most cases, bit 6 (DIAGF) will be set to indicate 
  1327. that an internal diagnostic failure occurred. 
  1328.  
  1329. Bit 6-Internal Diagnostic Failure (DIAGF): This bit, when one, indicates that 
  1330. the self-testing process has completed and that an error was detected. The host 
  1331. adapter must be reset by setting the Hard Reset bit (bit 7 of the Control Port) 
  1332. to clear the error. If the AHA-154XA again detects an error, troubleshooting 
  1333. procedures must be performed to identify and correct the error condition. The 
  1334. diagnostic LED will usually present a flash code that indicates the nature of 
  1335. the failure. Section 10 describes the corrective procedures. 
  1336.  
  1337. Bit 5-Mailbox Initialization Required (INIT):This bit, when one, indicates that 
  1338. the self-testing process has completed successfully and that the AHA-154XA is 
  1339. ready for mailbox initialization to be performed. The base memory address of 
  1340. the Mailbox area must be established by execution of the Mailbox Initialization 
  1341. command. After execution of the Mailbox Initialization command and any other 
  1342. desired initialization operations, the AHA-154XA is ready for full operation. 
  1343.  
  1344. Bit 4-SCSI Host Adapter Idle (IDLE):This bit, when one, indicates that the host 
  1345. adapter is in the idle state. The host adapter has no outstanding Adapter 
  1346. Commands or SCSI commands. The host processor must wait for the idle state 
  1347. before executing any Adapter Command except the Start SCSI (02) and Enable 
  1348. Mailbox Out Interrupt (05) commands. 
  1349.  
  1350. Bit 3-Command / Data Out Port Full (CDF): The host uses the CDF bit to 
  1351. synchronize command and data transfers to the host adapter. An Adapter Command 
  1352. byte or an outbound parameter byte can be placed in the Command / Data Out Port 
  1353. when the port is empty, indicated by the CDF bit being zero. When a byte is 
  1354. placed in the Command / Data Out Port, the CDF bit is set to one and remains 
  1355. one until the host adapter has obtained and processed the byte. When the CDF 
  1356. bit returns to zero, the next Command or parameter byte can be placed in the 
  1357. port. 
  1358.  
  1359. Bit 2-Data In Port Full (DF): The host uses the DF bit to synchronize transfers 
  1360. of data from the host adapter to the host. When the DF bit is set to one, the 
  1361. host adapter has placed a byte in the Data In Port for the host to remove and 
  1362. process. When the host performs a read to the Data In Port address, the DF bit 
  1363. is set back to zero automatically and not set to one again until a new data 
  1364. byte has been placed in the Data In Port by the host adapter for the host. 
  1365.  
  1366. Bit 1-Reserved: This bit is zero. 
  1367.  
  1368. Bit 0-Invalid Host Adapter Command (INVDCMD): The Invalid Host Adapter Command 
  1369. bit is set to one if an invalid command or parameter byte was received in the 
  1370. Command / Data Out Port . After sending a command byte or data byte, the host 
  1371. software determines that the next byte is ready to send by waiting for the CDF 
  1372. bit to be reset.  If the command byte or parameter byte is not valid, the 
  1373. command sequence will instead be terminated by the host adapter. The host 
  1374. adapter always terminates a command by raising the Host Adapter Command 
  1375. Complete (HACC) interrupt. If the HACC interrupt is set to one and the INVDCMD 
  1376. bit is not  set, the command terminated normally. If the INVDCMD bit is also 
  1377. set to one, the command or parameter bytes were determined to be invalid and 
  1378. the command terminated abnormally. The INVDCMD bit is only valid from the time 
  1379. the HACC interrupt is set until the HACC interrupt  is reset. The bit's value 
  1380. is not predictable until a new HACC interrupt is set for a new Adapter Command. 
  1381.  
  1382. 4.2.2 Command/Data Out and Data  In Port 
  1383.  
  1384. The second I/O port address is used by the host to write Adapter Command bytes 
  1385. and accompanying parameter data bytes to the host adapter. It is also used by 
  1386. the host adapter to send parameters back to the host to be read. The Command / 
  1387. Data Out Port is used by the host to send host adapter initialization and 
  1388. management commands and parameters that cannot be sent by the standard Mailbox 
  1389. protocol. Information requested by the Adapter Commands placed in the Command / 
  1390. Data Out Port is returned through the Data In Port. The host should understand 
  1391. the format and number of bytes to be transmitted for each command so that extra 
  1392. invalid bytes are not passed across the interface.  Bytes in addition to those 
  1393. required by the particular command are likely to be interpreted as invalid, 
  1394. although they may instead cause the execution of valid commands that were not 
  1395. supposed to be performed. 
  1396.  
  1397. The host should only write to the Command / Data Out Port when CDF is zero. 
  1398. This allows time for the host adapter to process a previously written command 
  1399. or parameter byte. CDF is automatically set to one when the host writes to the 
  1400. port and is reset to zero after the host adapter removes the byte from the 
  1401. port. 
  1402.  
  1403. If an Adapter Command needs additional data bytes, the host waits until CDF is 
  1404. zero before writing the additional bytes to the Command / Data Out Port. Just 
  1405. as in the command transfer case, each parameter byte written will set the CDF. 
  1406. The host can write additional data bytes only after CDF is again zero. The HACC 
  1407. interrupt will indicate when the command has terminated, normally or 
  1408. abnormally. If INVDCMD is also set, the host adapter found either the command 
  1409. or data bytes to be invalid and terminated abnormally. The use of CDF as a 
  1410. hand-shaking bit is required to prevent the transfer of invalid data. 
  1411.  
  1412. If an Adapter Command requires data transfer from the host adapter, the host 
  1413. adapter will place the data bytes in the Data In Port and set the DF bit 
  1414. (Status Port bit 2) to indicate that the requested parameter is ready for the 
  1415. host to read. When the host reads the Data port, DF is automatically reset. The 
  1416. host should wait until DF is again set before attempting to transfer the next 
  1417. parameter byte. The use of the DF bit to control the hand-shaking process is 
  1418. required to prevent the transfer of invalid data. After the last data byte has 
  1419. been transferred, the HACC interrupt bit will be set indicating command 
  1420. completion. If the Adapter Command was invalid, the HACC interrupt will occur 
  1421. before all data bytes have been transmitted and the INVDCMD bit will be set. 
  1422.  
  1423. 4.2.3 Interrupt Flag Port 
  1424.  
  1425. The Interrupt Flag Port contains bits that indicate the reason that an 
  1426. interrupt was provided to the host from the host adapter. The host adapter uses 
  1427. the interrupt to notify the host that the host adapter is ready for immediate 
  1428. service from the host. The Interrupt Flag Port is a read-only port. When an 
  1429. interrupt bit is set by the host adapter to indicate that the host should 
  1430. respond, the Any Interrupt bit and the interrupt line are both also set. When 
  1431. the host begins to examine the returned registers and mailboxes to determine 
  1432. the cause of the interrupt and to perform the operations needed to service the 
  1433. interrupt, the host will first read the Interrupt Flag Port to record which 
  1434. interrupts must be serviced. The host will then clear the interrupts by setting 
  1435. the IRST bit (Host Adapter Control Port bit 5). The host adapter presents MBOA 
  1436. and MBIF interrupts immediately unless there is already an SCRD or HACC 
  1437. interrupt present. If the SCRD or HACC is present, the MBOA and/or MBIF 
  1438. interrupt will be posted after the SCRD or HACC interrupt is cleared. An SCRD 
  1439. or HACC interrupt will only be presented if the Any Interrupt signal is zero 
  1440. and the DF signal is zero, indicating the completion of all pending interrupt 
  1441. presentation. It is recommended that the MBOA interrupt be enabled only when 
  1442. required by the host. This prevents the possible presentation and resetting of 
  1443. MBIF interrupts before they are processed. Other reset operations will also 
  1444. reset the Interrupt Flag Port and the interrupt line, including the Hard Reset 
  1445. bit (HRST), the Soft Reset bit (SRST), and the power on reset issued by the 
  1446. motherboard. 
  1447.  
  1448. Base+2 Port, Read only: Interrupt Flag Port 
  1449.  
  1450. Bit 7-Any Interrupt: This bit, when one, indicates that  the interrupt to the 
  1451. host has been established. The actual identify of the interrupting condition is 
  1452. provided in bits 0 to 3. 
  1453.  
  1454. Bit 6-Reserved: Returned as zero. 
  1455.  
  1456. Bit 5-Reserved: Returned as zero. 
  1457.  
  1458. Bit 4-Reserved: Returned as zero. 
  1459.  
  1460. Bit 3-SCSI Reset Detected (SCRD): This bit, when one, indicates that a SCSI 
  1461. Reset has been received on the SCSI bus. The Any Interrupt bit and the AT 
  1462. interrupt signal will also be set. The host adapter supports SCSI Soft Reset 
  1463. (see section 4.3). Any ongoing target or initiator activities will continue 
  1464. normally after first clearing the SCSI bus. In some rare cases, host 
  1465. intervention will be required to restart a SCSI command that was aborted by the 
  1466. reset operation. The host can convert the SCSI Soft Reset to a SCSI Hard Reset 
  1467. by setting the Control Register Soft Reset (Bit 6) to one, clearing all ongoing 
  1468. operations in the host adapter. In this case, the host must recognize that any 
  1469. operations not yet completed will never be completed and must perform 
  1470. appropriate error recovery operations. See section 4.3, describing the overall 
  1471. reset protocol. The SCRD bit is not set for host initiated SCSI Reset 
  1472. conditions caused by the setting of the HRST bit  or the SCRST bit, since the 
  1473. host is already aware of the actions it has requested. If the Any Interrupt 
  1474. signal or DF signal is present, the SCRD interrupt will not be presented until 
  1475. the interrupts already present are cleared. 
  1476.  
  1477. Bit 2-Host Adapter Command Complete (HACC): This bit, when one, indicates that 
  1478. an Adapter command has been completed, normally or abnormally. The Any 
  1479. Interrupt bit and the AT interrupt signal will also be set. If the command was 
  1480. completed normally, only the HACC bit will be on. If the command was completed 
  1481. abnormally or was aborted before it was completed, the HACC bit will be one and 
  1482. the Invalid Command Bit (Status Register bit 5) will also be one. During 
  1483. parameter transfers to or from the host adapter, the HACC bit should be 
  1484. examined to verify  that  the command is still being processed and has not been 
  1485. ended abnormally. If the Any Interrupt signal or DF signal is set, the HACC 
  1486. interrupt will not be presented until the interrupts already presented are 
  1487. cleared. 
  1488.  
  1489. Bit 1-Mailbox Out Available (MBOA): This bit, when one, indicates that an 
  1490. outbound Mailbox entry is now available for use by the host. The Any Interrupt 
  1491. bit and the AT interrupt signal will also be set. Most operating systems will 
  1492. choose to leave this interrupt disabled to avoid the generation of extra 
  1493. interrupts. The host adapter will normally empty Mailbox Out entries to its 
  1494. local RAM so rapidly that round robin filling of the Mailbox Out entries will 
  1495. assure that a Mailbox Out entry will already be empty by the time that the host 
  1496. is ready to fill it again. 
  1497.  
  1498. If the host finds that all Mailbox Out entries are full, it can enable the 
  1499. Mailbox Out Available interrupt by executing an Enable Mailbox Out Interrupt 
  1500. command through the I/O Command Port. The Enable Mailbox Out Interrupt command 
  1501. is one of the two commands that can be executed without waiting for the IDLE 
  1502. state of the host adapter. As soon as any Mailbox Out entry is cleared by the 
  1503. host adapter, an MBOA interrupt will be generated to indicate to the host that 
  1504. an MBO entry is available. An MBOA interrupt is generated after that each time 
  1505. a Mailbox Out entry is cleared by the host adapter until an Enable Mailbox Out 
  1506. Interrupt command is executed to force the reporting of MBOA interrupts to be 
  1507. disabled. If the SCRD or HACC interrupts are present, the MBOA interrupt is not 
  1508. presented until they are cleared. At all other times, MBOA is presented 
  1509. immediately. 
  1510.  
  1511. Bit 0-Mailbox In Full (MBIF): This bit, when one, indicates that an entry has 
  1512. been placed by the host adapter in the Mailbox In.  The interrupt should be 
  1513. reset as soon as possible so that any subsequent interrupts can be detected. 
  1514. The host adapter may return information in other Mailbox In entries, so the 
  1515. host should check the next entry to determine if more than one set of 
  1516. information has been provided. The MBI entries are filled in round-robin order, 
  1517. so the host should simply check the next MBI entry after the last one that was 
  1518. found when a new MBIF interrupt occurs. 
  1519.  
  1520. If an MBIF interrupt is set and other Mailbox In entries are made before the 
  1521. interrupt is cleared, then all the entries can be scanned as found. The new 
  1522. MBIF interrupt will be presented if the SCRD and HACC interrupts are cleared. A 
  1523. new MBIF interrupt will be presented regardless of the state of the MBOA 
  1524. interrupt bit. It is important to clear and record each interrupt as soon as 
  1525. possible to avoid the possible accidental resetting of a valid interrupt. In 
  1526. addition, it is desirable to enable the MBOA interrupt as rarely as possible. 
  1527. The host system software must be ready to scan for MBI entries even if no MBIF 
  1528. interrupt occurred. 
  1529.  
  1530.  
  1531. 4.3 RESET OVERVIEW 
  1532.  
  1533. The reset functions provided by the AHA-154XA are extensive to allow the 
  1534. fullest flexibility and architectural consistency, both with SCSI and with the 
  1535. Industry Standard Architecture. 
  1536.  
  1537. 4.3.1 Hard Reset Operations 
  1538.  
  1539. Resets may be generated by the hardware through two mechanisms. The RESET 
  1540. signal from the ISA socket is generated by the system board to reset or 
  1541. initialize all installed adapters upon power on or during a low line voltage 
  1542. condition. The system can also activate this signal under host program control. 
  1543. In addition to the RESET signal, the setting of the HRST bit (bit 7 of the Host 
  1544. Adapter Control Port) will force a hardware reset to the AHA-154XA. Regardless 
  1545. of the source, a Hard Reset forces the following actions on the AHA-154XA. 
  1546.  
  1547.     All  internal registers of the AHA-154XA are returned to their reset 
  1548. condition. 
  1549.     The host adapter's microprocessor returns all internal information 
  1550. and parameters to their initial state. 
  1551.     The host adapter performs all required internal diagnostics. 
  1552.     A standard SCSI Reset condition is generated to all other attached SCSI 
  1553. devices. 
  1554.  
  1555. During the Hard Reset process, the AHA-154XA will indicate to the attached host 
  1556. that self-testing is in process by raising the STST bit in the Host Adapter 
  1557. Status Port. After the Hard Reset process is complete, the AHA-154XA will 
  1558. indicate that initialization parameters are required from the host by raising 
  1559. the INIT bit in the Host Adapter Status Port. 
  1560.  
  1561. 4.3.2 SCSI Reset Operations 
  1562.  
  1563. The SCSI Reset condition is defined in the SCSI Standard, X3.131-1986, section 
  1564. 5.2.2. A SCSI Reset condition may be forced by any SCSI device on the bus. The 
  1565. condition is forced by the assertion of the SCSI Reset signal. 
  1566.  
  1567. The AHA-154XA has four mechanisms which may force a SCSI Reset condition. The 
  1568. SCSI Reset condition may be invoked from the host software if the software sets 
  1569. the SCRST bit (Bit 4 of the Host Adapter Control Port). In this case, the 
  1570. normal SCSI Reset operations will be performed by the Host Adapter and the SCSI 
  1571. Reset signal will be asserted on the SCSI bus. In this case, the SCRD bit 
  1572. (Interrupt Flag Port bit 3) will not be set, since the host itself caused the 
  1573. reset. 
  1574.  
  1575. The SCSI Reset is invoked if a hard reset is generated, either by the system 
  1576. board RESET signal or by the setting of the HRST bit. This reset is described 
  1577. in Section 4.3.1. 
  1578.  
  1579. The SCSI Reset condition may be invoked by the AHA-154XA as part of the 
  1580. recovery mechanism for a bus phase error. Bus phase errors may include 
  1581. detection of an invalid information transfer phase or detection of an 
  1582. impossible phase sequence (Command Phase after a Data Phase in the same 
  1583. command). In this case, the normal SCSI Reset operations will be performed and 
  1584. the SCSI Reset signal will be asserted on the SCSI bus. In addition,  the SCRD 
  1585. bit (Interrupt Flag Port bit 3) will be set to indicate to the host computer 
  1586. that a SCSI Reset condition occurred. The setting of the SCRD bit also causes 
  1587. the Any Interrupt bit (Interrupt Flag Port bit 7) and the appropriate interrupt 
  1588. signal  to be presented. 
  1589.  
  1590. The SCSI Reset condition may be invoked by another SCSI device attached to the 
  1591. AHA-154XA as part of the other device's recovery mechanism or initialization 
  1592. procedure. In this case, the normal SCSI Reset operations will be performed. In 
  1593. addition,  the SCRD bit (Interrupt Flag Port bit 3) will be set to indicate to 
  1594. the host computer that a SCSI Reset condition occurred. The setting of the SCRD 
  1595. bit also causes the Any Interrupt bit (Interrupt Flag Port bit 7) and the 
  1596. appropriate ISA interrupt  signal to be presented. 
  1597.  
  1598.  
  1599. 4.3.2.1 SCSI "Soft" Reset Option 
  1600.  
  1601. The SCSI standard indicates two optional methods of handling the normal SCSI 
  1602. Reset operations. The AHA-154XA implements the "Soft" Reset Option, described 
  1603. in section 5.2.2.2 of the SCSI specification. The "Soft" Reset Option is 
  1604. designed to allow a SCSI Reset signal to correctly clear the SCSI bus, but to 
  1605. allow ongoing system operations to continue without any major interruptions. 
  1606. When the SCSI Reset occurs, any activity on the SCSI bus is immediately halted 
  1607. and all bus lines are cleared from the bus. After the Reset condition ends, any 
  1608. operations in progress are again allowed to start up in the normal manner. No 
  1609. status or pointer information is destroyed. All disconnected commands are 
  1610. allowed to reselect and continue in the normal manner. This "Soft" Reset 
  1611. function allows a multiple initiator system to use reset to clear certain types 
  1612. of bus failures without damaging ongoing tasks from any initiator. 
  1613.  
  1614. The SCSI "Soft" Reset option is useful in multitasking systems that cannot 
  1615. tolerate the overhead of a complex reconfiguration and reinitialization after a 
  1616. normal reset operation. For the SCSI "Soft" Reset option to operate correctly, 
  1617. all SCSI devices that communicate on the SCSI bus must support the "Soft" Reset 
  1618. option. If any SCSI devices support the "Hard" Reset option, it is likely that 
  1619. operations will be terminated without warning and the system will have to time 
  1620. out and monitor the requirement to restart some activities. 
  1621.  
  1622.  
  1623. 4.3.2.2 SCSI "Hard" Reset Option
  1624.  
  1625. The "Hard" Reset Option is designed to restore all attached SCSI devices, 
  1626. including both hosts and peripheral devices, to their power on reset state. All 
  1627. system activities that have not been recorded on a non-volatile memory device 
  1628. or through another SCSI path are completely lost and must be restarted. The 
  1629. system must be completely re-initialized. For certain types of systems that 
  1630. frequently do back-up or check point their transactions, that re-initialize 
  1631. quickly and easily, or that infrequently do resets, the "Hard" Reset Option is 
  1632. appropriate. The AHA-154XA responds to a SCSI Reset Condition by executing only 
  1633. the "Soft" Reset Option, but it notifies the host whenever a SCSI Reset 
  1634. condition has been established by causing an interrupt to the host. The host 
  1635. then has the option of converting the "Soft" Reset to a "Hard" Reset by forcing 
  1636. the host adapter to clear all the ongoing operations and return to its initial 
  1637. state. The host requests this by raising the SRST bit (bit 6 of the Host 
  1638. Adapter Control Port). The host must raise the SRST bit within 300 microseconds 
  1639. to disable the restarting of operations according to the rules of "Soft" Reset. 
  1640. The raising of the SRST bit causes the host adapter to abandon all CCB's and 
  1641. prepare itself to begin accepting new instructions from the host. No secondary 
  1642. SCSI Reset signals are activated. The Mailbox initialization and all normal 
  1643. SCSI initial conditions are reset by the SRST bit, so that reinitialization is 
  1644. required to restart the system. Of course the system still has the right at any 
  1645. time that the IDLE bit (bit 4 of the Host Adapter Status Port) is on to execute 
  1646. any of the Adapter Commands and modify the Mailbox Address or the SCSI initial 
  1647. conditions. 
  1648.  
  1649. If the host requires that the SCSI be reset according to the SCSI "Hard" Reset 
  1650. option, the host raises the HRST bit. The host adapter will then set a SCSI 
  1651. Reset Condition on the SCSI Bus and clear all its CCB and status information, 
  1652. thus performing a SCSI "Hard" Reset with a single load to the Host Adapter 
  1653. Control Port. Reinitialization will be required. 
  1654.  
  1655.  
  1656. 5.1 HOST ADAPTER COMMAND OVERVIEW 
  1657.  
  1658. The AHA-1540A/1542A supports two types of commands: SCSI and Adapter Commands. 
  1659. SCSI commands are issued using the mail box protocol and a Command Control 
  1660. Block. When SCSI commands are used, the AHA-1540A/1542A is operating in true 
  1661. multithreading mode. In this mode of operation, the AHA-1540A/1542A is capable 
  1662. of executing multiple commands for multiple targets concurrently. The AHA-
  1663. 1540A/1542A maximizes the I/O transaction throughput by managing SCSI 
  1664. disconnection and reconnection. 
  1665.  
  1666. Adapter Commands are issued by writing to the Command / Data Out port. Most 
  1667. Adapter commands can not be issued when there are outstanding SCSI commands. 
  1668. Adapter commands are used to initialize the host adapter and to establish 
  1669. control conditions within the host adapter. Adapter commands are also used to 
  1670. transmit the special parameters for communication between the BIOS and the host 
  1671. adapter for the execution interrupt 13 operations. 
  1672.  
  1673.  
  1674. 5.1.1 Adapter Command Operation Codes 
  1675.  
  1676. Below is a list of the Adapter Command operation codes. 
  1677.  
  1678. 00 -- No Operation
  1679. 01 -- Mailbox Initialization
  1680. 02 -- Start SCSI Command *
  1681. 03 -- Start PC/AT BIOS Command 
  1682. 04 -- Adapter Inquiry
  1683. 05 -- Enable Mailbox Out Available Interrupt*
  1684. 06 -- Set Selection Time-out
  1685. 07 -- Set Bus-On Time
  1686. 08 -- Set Bus-Off Time
  1687. 09 -- Set Transfer Speed
  1688. 0A -- Return Installed Devices
  1689. 0B -- Return Configuration Data
  1690. 0C -- Enable Target Mode **
  1691. 0D -- Return Setup Data **
  1692. 1A -- Write Adapter Channel 2 Buffer **
  1693. 1B -- Read Adapter Channel 2 Buffer **
  1694. 1C -- Write Adapter FIFO Buffer
  1695. 1D -- Read Adapter FIFO Buffer
  1696. 1F -- ECHO Command Data 
  1697.  
  1698. *Note: This command can be issued when the host adapter is executing a SCSI 
  1699. command. 
  1700. ** These commands are not supported by the AHA-1540. 
  1701.  
  1702.  
  1703. All Adapter Commands except Start SCSI (02) and Enable Mailbox-Out Available 
  1704. Interrupt (05) must be executed only when the IDLE bit (Status bit 4) is one. 
  1705. Many commands require additional parameter bytes which are then written to the 
  1706. Command / Data Out I/O port (base + 1). Before each byte is written by the host 
  1707. to the host adapter, the host must verify that the CDF bit (Status bit 3) is 
  1708. zero, indicating that the command port is ready for another byte of 
  1709. information. The host adapter usually clears the Command / Data Out Port within 
  1710. 100 microseconds. Some commands require information bytes to be returned from 
  1711. the host adapter to the host. In this case, the host monitors the DF bit 
  1712. (Status bit 2) to determine when the host adapter has placed a byte in the Data 
  1713. In I/O port for the host to read. The DF bit is reset automatically when the 
  1714. host reads the byte. The format of each Adapter Command is strictly defined, so 
  1715. the host adapter and host system can always agree upon the correct number of 
  1716. parameter bytes to be transferred during a command. 
  1717.  
  1718. All  Adapter Commands except Return Installed devices, Start SCSI, and Start 
  1719. PC/AT BIOS typically require less than 200╡s to complete. Return installed 
  1720. devices will typically complete in less than 3 seconds. Start SCSI and Start 
  1721. PC/AT commands completion times will vary with the SCSI device and the command 
  1722. issued. 
  1723.  
  1724.  
  1725. 5.1.1.1 No Operation  (Operation Code 00) 
  1726.  
  1727. No host adapter action is taken, but HACC is set indicating command completion. 
  1728. No additional information bytes are exchanged. 
  1729.  
  1730.  
  1731. 5.1.1.2 Mailbox Initialization (Operation Code 01) 
  1732.  
  1733. This command is used to specify the number of mailbox locations used by the 
  1734. host adapter and to specify the base memory location of the mailbox area. The 
  1735. host adapter requires that four bytes of outbound data  follow the command 
  1736. byte. The definition of those four bytes is shown below. 
  1737.  
  1738. 00  Mailbox count  (>0)
  1739. 01  Mailbox address (MSB)
  1740. 02  Mailbox address 
  1741. 03  Mailbox address (LSB) 
  1742.  
  1743. Byte 0 Mailbox Count: The Mailbox count must be greater than zero. 
  1744.  
  1745. Byte 1,2,3 Mailbox Address: The Mailbox address specifies the location of the
  1746.                              first byte of the Mailbox area. Byte 1 is the most
  1747.                              significant byte. 
  1748.  
  1749.  
  1750. When the Mailbox Initialization command and parameters are received,  the host 
  1751. adapter will then assume that the specified number of Mailbox Out entries and 
  1752. the same number of Mailbox In entries will be assigned beginning at the Mailbox 
  1753. address. The total number of bytes reserved for the Mailbox area will be eight 
  1754. times the Mailbox count. If the Mailbox Count is zero, the INVDCMD bit will be 
  1755. set with HACC to indicate that the parameter is invalid.     
  1756.  
  1757. At command completion, HACC will be set to one and INIT will be reset to zero. 
  1758. HACC will be reset as specified by section 4.2.3. 
  1759.  
  1760. 5.1.1.3 Start SCSI Command (Operation Code 02)
  1761.  
  1762. This command indicates that the host has made at least one Mailbox Out entry 
  1763. and that the host adapter should begin to scan for active MBO entries. Once 
  1764. scanning has been started, it continues until all MBO entries have been 
  1765. serviced, either by beginning the requested operations or by queueing the 
  1766. activities for later execution.  Since it is not easy for the host to determine 
  1767. that scanning is still taking place, the host should normally issue this 
  1768. command every time a Mailbox Out is filled. This command does not require 
  1769. additional data bytes. To avoid unnecessary interrupts, HACC is NOT set after 
  1770. command completion. HACC will be set with INVDCMD if the mailbox was not yet 
  1771. initialized. 
  1772.  
  1773.  
  1774. 5.1.1.4 Start PC/AT BIOS Command (Operation Code 03) 
  1775.  
  1776. This command is used by the Adaptec BIOS to communicate with the host adapter 
  1777. firmware. The command is not available for use by programs other than the 
  1778. Adaptec BIOS. 
  1779.  
  1780.  
  1781. 5.1.1.5 Adapter Inquiry (Operation Code 04) 
  1782.  
  1783. After receiving this command, the host adapter returns four bytes of data 
  1784. describing the host adapter firmware revision level. After completing the 
  1785. transfer of the four bytes of inbound data, the HACC interrupt is set 
  1786. indicating normal command completion. The bytes contain the following 
  1787. information: 
  1788.  
  1789. 00  Board Identification 
  1790. 01  Special Options Identification
  1791. 02  Hardware Revision Level
  1792. 03  Firmware Revision (ASCII) 
  1793.  
  1794. Byte 0 Board ID: The value in this byte allows software supported on both the 
  1795.                  PC/AT and on the Microchannel(tm) to distinguish the type of
  1796.                  supporting host adapter. 
  1797. Value             Meaning
  1798. 00H- board is an AHA-1540 with 16 Head BIOS
  1799. 30H- ('0' ASCII) Board is an AHA-1540 with 64 Head BIOS
  1800. 41H- ('A' ASCII) Board is an AHA-1540A/1542A, 64 Head BIOS
  1801. 42H- ('B' ASCII)    Board is an AHA-1640, 64 Head BIOS
  1802. All Others- Reserved 
  1803.  
  1804. Byte 1  Special Options ID: The value in this byte indicates what special
  1805.                             options are supported on the AHA-154XA host 
  1806.                             adapter. Other host adapters use other values in 
  1807.                             this byte. 
  1808.  
  1809. Value              Meaning 
  1810. 41H- ('A' ASCII)    Board is standard model
  1811. All Others- Reserved 
  1812.  
  1813. Byte 2 Firmware Revision: This value indicates an ASCII value from 0-9,A-Z that
  1814.                           indicates the firmware revision installed in the AHA-
  1815.                           154XA.
  1816.  
  1817. Byte 3 Firmware Revision: This value indicates an ASCII value from 0-9,A-Z that
  1818.                           indicates the firmware revision installed in the AHA-
  1819.                           154XA. 
  1820.  
  1821. After completing this command, HACC will be asserted, indicating normal 
  1822. completion. 
  1823.  
  1824.  
  1825. 5.1.1.6 Enable Mailbox-Out Available Interrupt (Operation Code 05) 
  1826.  
  1827. The Enable Mailbox Out Available Interrupt command specifies that a Mailbox Out 
  1828. Available Interrupt should be generated whenever a Mailbox Out entry has been 
  1829. cleared by the host adapter. One byte of outbound data is transmitted to 
  1830. indicate whether the interrupt should be enabled or disabled. 
  1831.  
  1832. Byte 0 Enable/Disable Parameter: The Enable/Disable parameter byte must be 
  1833.                                  either 00H or 01H. If the Enable/Disable 
  1834.                                  parameter byte is 00H, the Mailbox Out 
  1835.                                  Available interrupt  is not returned. If the 
  1836.                                  Enable/Disable parameter byte is 01H, the 
  1837.                                  Mailbox Out Available interrupt is returned as
  1838.                                  soon as a Mailbox Out has been cleared by the
  1839.                                  host adapter. 
  1840.  
  1841. After completing this command, HACC will NOT be asserted to avoid generating 
  1842. additional interrupts. If the data byte is neither 00 nor 01, INVDCMD will be 
  1843. asserted indicating an invalid command. In this case, HACC will also be 
  1844. asserted. 
  1845.  
  1846. The Mailbox Out Available interrupt is normally intended to be used by the host 
  1847. as an indicator that a Mailbox Out entry is available. This function should 
  1848. only be enabled if all Mailbox Out entries have been found full by the host. It 
  1849. should be disabled soon afterward. If used in other ways, the interrupt may 
  1850. generate a large number of relatively useless interrupt handling activities. 
  1851.  
  1852.  
  1853. 5.1.1.7 Set Selection Time-out  (Operation Code 06)
  1854.  
  1855. This command sets the SCSI selection time out value. The SCSI Selection time 
  1856. out value is used to determine whether or not a SCSI selection was successful. 
  1857. If the SCSI BSY signal is not returned within the specified time out value, the 
  1858. selection will be terminated and an appropriate error message posted with the 
  1859. returned CCB. This command expects four outbound data bytes to be provided as 
  1860. defined below: 
  1861.  
  1862. 00 Enable/Disable Selection Time Out    
  1863. 01 Reserved  (00)
  1864. 02 Time Out Value (MSB)
  1865. 03 Time Out Value (LSB)
  1866.  
  1867. Byte 0- Enable/Disable Selection Time Out: This parameter byte specifies whether 
  1868. or not the Selection Time-out will be used. If the byte is set to 00H,   no 
  1869. time-out will be performed. If the byte is set to 01H, the time specified in 
  1870. bytes 02 and 03 will be used as the Selection Time Out by the SCSI. The default 
  1871. value established by the reset process is 01H, indicating the time out is 
  1872. enabled. 
  1873.  
  1874. Byte 1-Reserved:    This byte must be zero. 
  1875.  
  1876. Byte 2,3-Time Out Value:    This two-byte value specifies the time in milliseconds 
  1877. that will be used for the Selection Time Out. The default value is 250 
  1878. milliseconds. 
  1879.  
  1880. After completing this command, HACC will be asserted, indicating normal 
  1881. completion. INVDCMD will be asserted if the data byte 0 is neither 00 nor 01 or 
  1882. if byte 1 is not zero, indicating an invalid command. 
  1883.  
  1884.  
  1885. 5.1.1.8 Set Bus-On Time (Operation Code 07)
  1886.  
  1887. This command specifies the time that the host adapter spends on the bus when 
  1888. transferring data. The Bus-On duration is adjustable from 2 to 15 microseconds. 
  1889. The default setting is 11us. One data byte is passed out to the host adapter to 
  1890. indicate the Bus-On duration in microseconds. 
  1891.  
  1892. Data Byte 0 -- Bus On-Time (2 to 15 us)
  1893.  
  1894. After completing this command, HACC will be asserted indicating normal 
  1895. completion. INVDCMD will be asserted, indicating an invalid command, if the 
  1896. data byte is greater than 15. The valid range is 2 to 15 decimal. 
  1897.  
  1898.  
  1899. 5.1.1.9 Set Bus-Off Time (Operation Code 08)
  1900.  
  1901. This command sets the time that  the host adapter will spend off the bus during 
  1902. a data transfer. The Bus-On duration is adjustable from 1 to 64 microseconds. 
  1903. The default setting is 4us. After receiving this command, the host adapter 
  1904. expects one byte of data which specifies the bus off time in microseconds. 
  1905.  
  1906. Data Byte 0 -- Bus-Off Time ( 1 to 64 us)
  1907.  
  1908. After completing this command, HACC will be asserted indicating normal 
  1909. completion. INVDCMD will be asserted, indicating an invalid command, if the 
  1910. data byte is greater than 64. The valid range is 1 to 64 decimal. The actual 
  1911. time implemented by the host adapter is rounded down to the next four 
  1912. microsecond step at or below the specified value. The minimum value is 
  1913. approximately one microsecond. 
  1914.  
  1915. 5.1.1.10 Set Transfer Speed (Operation Code 09)
  1916.  
  1917. This command adjusts the Bus Master DMA circuitry to a specified maximum AT bus 
  1918. transfer speed to and from the host memory. Several speeds may be selected by 
  1919. setting the jumper configuration as explained in section 3.3. The selected 
  1920. jumper speeds are overridden if the Set Transfer Speed command is executed. The 
  1921. single data byte transmitted after the command byte either sets the read and 
  1922. write speed together, or establishes separate values for each. Appendix A gives 
  1923. the timings that result from the selected values. The default setting is the 
  1924. value set by the jumpers. The I/O Channel Ready signal automatically slows the 
  1925. system further if required by the host memory. 
  1926.  
  1927. Data Byte 0     -- AT Bus Transfer Speed
  1928.                     00 -- 5.0 MB/second
  1929.                     01 -- 6.7 MB/second
  1930.                     02 -- 8.0 MB/second
  1931.                     03 -- 10 MB/second
  1932.                     04-- 5.7 MB/second
  1933.                     80-FF-- See Table
  1934. After completing this command HACC is set indicating normal completion. 
  1935.  
  1936. 5.1.1.11 Return Installed Devices (Operation Code 0A)
  1937.  
  1938. This command returns information about which SCSI Targets and Logical Units 
  1939. (LU's) are installed on the SCSI bus. The host adapter issues the SCSI Test 
  1940. Unit Ready command to each target/LUN combination and reports the results using 
  1941. eight bytes of data returned through the Data In Register. A bit having a value 
  1942. of one indicates that the associated LU is installed.  Each byte is associated 
  1943. with the  corresponding target. Each bit within a target byte is associated 
  1944. with a particular Logical Unit, bit 7 indicating the presence of LU 7 and so 
  1945. forth. The state of the target is analyzed using the SCSI TEST UNIT READY 
  1946. command, analyzing the returned data to determine if the addressed LU is 
  1947. available. 
  1948.  
  1949. After receiving this command, the host adapter returns eight bytes of 
  1950. information which specify the installed configuration  as shown below: 
  1951.  
  1952. Byte 0          Target 0 Configuration:
  1953.  
  1954.                 Bit 7 LU 7 Installed
  1955.                 Bit 6 LU 6 Installed
  1956.                 Bit 5 LU 5 Installed
  1957.                 Bit 4 LU 4 Installed
  1958.                 Bit 3 LU 3 Installed
  1959.                 Bit 2 LU 2 Installed
  1960.                 Bit 1 LU 1 Installed
  1961.                 Bit 0 LU 0 Installed
  1962.  
  1963. Byte 1 Target 1 Configuration
  1964. Byte 2 Target 2 Configuration
  1965. Byte 3 Target 3 Configuration
  1966. Byte 4 Target 4 Configuration
  1967. Byte 5 Target 5 Configuration
  1968. Byte 6 Target 6 Configuration
  1969. Byte 7 Target 7 Configuration
  1970.  
  1971. The byte associated with the SCSI Device Identifier of the host adapter will 
  1972. always be zero. After completing the information transfer, the HACC bit will be 
  1973. set to indicate normal completion. 
  1974.  
  1975. 5.1.1.12 Return Configuration Data (Operation Code 0B)
  1976.  
  1977. The DMA arbitration priority, the Interrupt channel, and the SCSI ID of the 
  1978. adapter are returned by this command. The three bytes of information are 
  1979. returned in the following format: 
  1980.  
  1981. Byte 0 DMA Arbitration Priority:
  1982. Bit 7 Channel 7
  1983. Bit 6 Channel 6
  1984. Bit 5 Channel 5
  1985. Bits 4-1 Reserved (0)
  1986. Bit 0 Channel 0
  1987.  
  1988. Byte 1 Interrupt Channel:
  1989. Bit 7 Reserved (0)
  1990. Bit 6 Interrupt channel 15
  1991. Bit 5 Interrupt channel 14
  1992. Bit 4 Reserved (0)
  1993. Bit 3 Interrupt channel 12
  1994. Bit 2 Interrupt channel 11
  1995. Bit 1 Interrupt channel 10
  1996. Bit 0 Interrupt channel 9
  1997.  
  1998. Byte 2    SCSI Identifier
  1999. Bits 7-3 Reserved (0)
  2000. Bits 2-0 Binary value of SCSI Identifier
  2001.  
  2002. After completing this command, HACC will be set indicating normal completion. 
  2003.  
  2004.  
  2005. 5.1.1.13 Enable Target Mode Command (Operation Code 0C)
  2006.  
  2007. A special host adapter command  (0C)  enables and disables target mode. The 
  2008. host adapter requires that two bytes of outbound information follow the command 
  2009. byte. The information bytes contain the following information: 
  2010.  
  2011. Byte 0-  Enable/Disable Target Mode:    This parameter specifies which operating 
  2012. modes the host adapter will use. If the byte is set to 00H, the AHA-1540A/1542A 
  2013. will operate only in Initiator Mode. If the byte is set to 01H, the host 
  2014. adapter will operate both as an initiator and as a Processor type Target SCSI 
  2015. Device. Any other value is invalid. The default value after  a Hard Reset, Soft 
  2016. Reset, or Power On Reset is 00H (Initiator only). 
  2017.  
  2018. Byte 1-Logical Unit Mask: This parameter byte contains an eight bit bit-
  2019. significant mask indicating the Logical Units which will respond in Target 
  2020. Mode.  Bit 7 corresponds to LU 7, and so forth. If the bit is one, the 
  2021. corresponding LU will be treated as installed. If the bit is zero, the LU will 
  2022. be treated as not installed. 
  2023.  
  2024. If the AHA-1540A/1542A does not have the Target Mode feature installed, the 
  2025. host adapter will indicate an invalid host adapter command. If an attempt is 
  2026. made to change from target mode while there are still target mode CCB's being 
  2027. processed by the host adapter, the host adapter will post an invalid host 
  2028. adapter command indication. 
  2029.  
  2030. If the command disables Target Mode, the Logical Unit Mask byte will be 
  2031. ignored. If the command enables Target Mode, the Logical Unit Mask byte must 
  2032. contain at least one bit, indicating the presence of at least one Logical Unit. 
  2033.  
  2034. The SCSI INQUIRY command will provide an indication to other initiators that 
  2035. the Logical Unit is installed or not installed  in byte 1 of the returned 
  2036. inquiry data. 
  2037.  
  2038. If target mode is not enabled, the host adapter will behave on the SCSI 
  2039. interface as if it were an ordinary SCSI initiator. Any attempt to select the 
  2040. host adapter will result in a SCSI selection time out. Most Reset Operation, 
  2041. including Soft Reset, Hard Reset, and Power-On Reset will return the AHA-
  2042. 1540A/1542A Target Mode to the disabled state. SCSI Resets, generated either by 
  2043. the host or by other SCSI Devices, will not change the previously established 
  2044. enabled or disabled state of Target Mode. 
  2045.  
  2046.  
  2047. 5.1.1.14 Return Setup Data (Operation Code 0D)
  2048.  
  2049. This command returns information describing the setup of the host adapter. The 
  2050. information returned reflects either the values supplied by previous host 
  2051. adapter commands or default values. The command is followed by an outbound data 
  2052. transfer and an inbound data transfer. The outbound transfer is a one byte 
  2053. parameter indicating the length of the required inbound data transfer. The 
  2054. inbound data transfer contains from zero to 255 bytes of information describing 
  2055. the setup of the host adapter. The inbound information normally transferred 
  2056. will be truncated or padded with zeros as necessary to transfer the requested 
  2057. number of bytes. The number of bytes normally transferred by the AHA-154XA is 
  2058. 16. 
  2059.  
  2060.  Outbound Data Byte:
  2061.  
  2062. Byte 0     Data In Length: The number of data bytes requested can be from 0 to 
  2063.                            255. A value of zero will be accepted and 256 bytes
  2064.                            will be returned.
  2065.  
  2066. Inbound Data Summary:
  2067.  
  2068.  
  2069. 00     SDT and Parity Status
  2070. 01     Transfer Speed
  2071. 02     Bus On Time
  2072. 03     Bus Off Time
  2073. 04     Number of Mailboxes
  2074. 05     Mailbox Address (MSB)
  2075. 06     Mailbox Address
  2076. 07     Mailbox Address (LSB)
  2077. 08-0F  Synchronous Transfer Agreements
  2078. 10-FF  Reserved (00)
  2079.  
  2080. Inbound Data Bit Assignments:
  2081.  
  2082. Byte 0   SDT and Parity Status:
  2083.  
  2084.          Bit      Meaning
  2085.           0       If this bit is zero, Synchronous Data Transfer negotiation 
  2086.                   will not be initiated by the host adapter, but will be 
  2087.                   responded to if requested by an attached SCSI Device. If the 
  2088.                   bit is one, Synchronous Data Transfer negotiation will be
  2089.                   initiated by the host adapter under those conditions which
  2090.                   require such negotiation. The state is set from jumper J1.
  2091.  
  2092.           1       If this bit is zero, parity checking on inbound SCSI transfers
  2093.                   has been disabled. If this bit is one, parity checking on 
  2094.                   inbound SCSI transfers is enabled. The state is set from 
  2095.                   jumper J1.
  2096.  
  2097.          2-7      Reserved (0)
  2098.  
  2099. Byte 1 Transfer Speed-This byte returns the value passed in to the host adapter 
  2100.                       by the Set Transfer Speed command (See Section  5.1.1.10) 
  2101.  
  2102. Byte 2 Bus On Time:Indicates the Bus On Time in microseconds 
  2103.                    (See Section 5.1.1.8) 
  2104.  
  2105. Byte 3 Bus Off Time:Indicates the Bus Off Time specified by the Bus Off Time 
  2106. Value in microseconds. (See Section 5.1.1.9) 
  2107.  
  2108. Byte 4- Number of Mailboxes:The number of Mailboxes established by  a previous 
  2109. Mailbox Initialization command will be returned in this byte. This number will 
  2110. be 00H if the Mailbox Initialization command has not yet been successfully 
  2111. completed. 
  2112.  
  2113. Byte 5-7 -Mailbox Address:The base address of the Mailbox area established by a 
  2114. previous Mailbox Initialization command will be returned in these bytes. The 
  2115. Most Significant byte is byte 5. These bytes have no meaning if Mailbox 
  2116. Initialization has not yet been successfully completed. 
  2117.  
  2118. Byte 8-Sync Neg, Target 0 Returns information about the synchronous negotiation 
  2119. with Target 0. The byte will be 00H for the address of the host adapter. 
  2120.  
  2121. Bit 7-Set to one if synchronous transfer is negotiated. Set to zero if 
  2122. asynchronous transfer is being performed. 
  2123.  
  2124. Bits 6-4 -These bits contain a value between 0 and 7 that defines the 
  2125. synchronous transfer period according to the following equation. Period =200 +  
  2126. 50 (value) nanoseconds 
  2127.  
  2128. Bits 3-0 -These bits contain the negotiated offset value. The value will 
  2129. normally be between 1 and 7. 
  2130.  
  2131. Byte 9 Sync Neg, Target 1    Same as byte 8, for target 1 
  2132.  
  2133. Byte 10 Sync Neg, Target 2    Same as byte 8, for target 2 
  2134. Byte 11 Sync Neg, Target 3    Same as byte 8, for target 3
  2135. Byte 12 Sync Neg, Target 4    Same as byte 8, for target 4
  2136. Byte 13 Sync Neg, Target 5    Same as byte 8, for target 5
  2137. Byte 14 Sync Neg, Target 6    Same as byte 8, for target 6
  2138. Byte 15 Sync Neg, Target 7    Same as byte 8, for target 7
  2139.  
  2140. If the command completes normally, the HACC interrupt will be set to one. If 
  2141. the Mailbox area has not been properly initialized, all 16 bytes are still 
  2142. requested by the host. If byte 4, the Number of Mailboxes, is zero, bytes 5-7 
  2143. must be ignored. 
  2144.  
  2145. 5.1.1.15  Write Adapter Channel 2 Buffer (Operation Code 1A)
  2146.  
  2147. After receiving this command, the host adapter expects three outbound 
  2148. information bytes to be transferred which point to an area of 64 bytes in 
  2149. system RAM. The area pointed to will be transferred to the host adapter's 
  2150. Channel 2 Buffer using the host adapter's DMA circuitry.  After completing the 
  2151. transfer of the 64 bytes from the indicated buffer area to the host adapter, 
  2152. the HACC interrupt will be set indicating normal completion. This command is 
  2153. used in conjunction with the Read Channel 2 Buffer command for host  adapter 
  2154. diagnostics. The Channel 2 Buffer is used for transmission of all information 
  2155. except the actual data field between the host adapter and the host system. 
  2156.  
  2157. Byte 0       Buffer area address, Most significant byte
  2158. Byte 1       Buffer area address
  2159. Byte 2       Buffer area address, Least significant byte     
  2160.  
  2161. 5.1.1.16  Read Adapter Channel 2 Buffer (Operation Code 1B)
  2162.  
  2163. After receiving this command, the host adapter expects three outbound 
  2164. information bytes to be transferred which point to an area of 64 bytes in 
  2165. system RAM.  The area pointed to will be used as a buffer to receive 64 bytes 
  2166. of information transferred from the host adapter's Channel 2 Buffer to the 
  2167. host's memory using the host adapter's DMA circuitry. After completing the 
  2168. transfer of the 64 bytes from the Channel 2 Buffer to the indicated host memory 
  2169. area, the HACC interrupt will be set indicating normal completion. This command 
  2170. is used in conjunction with the Write Channel 2 Buffer command for host adapter 
  2171. diagnostics. 
  2172.  
  2173. Byte 0   Buffer area address, Most significant byte
  2174. Byte 1   Buffer area address
  2175. Byte 2   Buffer area address, Least significant byte 
  2176.  
  2177. 5.1.1.17 Write Adapter FIFO Buffer (Operation Code 1C)
  2178.  
  2179. After receiving this command, the host adapter expects three outbound 
  2180. information bytes to be transferred which point to an area of 54 bytes in 
  2181. system RAM. The area pointed to will be transferred to the host adapter's FIFO 
  2182. buffer using the host adapter's DMA circuitry.  After completing the transfer 
  2183. of the 54 bytes from the indicated buffer area to the host adapter, the HACC 
  2184. interrupt will be set indicating normal completion. This command is used in 
  2185. conjunction with the Read Adapter FIFO Buffer command for host  adapter 
  2186. diagnostics. 
  2187.  
  2188. Byte 0   Buffer area address, Most significant byte
  2189. Byte 1   Buffer area address
  2190. Byte 2   Buffer area address, Least significant byte     
  2191.  
  2192. 5.1.1.18 Read Adapter FIFO Buffer (Operation Code 1D)
  2193.  
  2194. After receiving this command, the host adapter expects three outbound 
  2195. information bytes to be transferred which point to an area of 54 bytes in 
  2196. system RAM.  The area pointed to will be used as a buffer to receive 54 bytes 
  2197. of information transferred from the host adapter's FIFO to the host's memory 
  2198. using the host adapter's DMA circuitry. After completing the transfer of the 54 
  2199. bytes from the FIFO to the indicated buffer area, the HACC interrupt will be 
  2200. set indicating normal completion. This command is used in conjunction with the 
  2201. Write Adapter FIFO Buffer command for host adapter diagnostics. 
  2202.  
  2203. Byte 0      Buffer area address, Most significant byte
  2204. Byte 1      Buffer area address
  2205. Byte 2      Buffer area address, Least significant byte     
  2206.  
  2207. 5.1.1.19 ECHO Command Data (Operation Code 1F)
  2208.  
  2209. This command is used to test the Command / Data Out Port, the Data In Port, and 
  2210. the associated control bits in the other I/O Ports.  After receiving this 
  2211. command, the host adapter expects one byte of outbound information to be 
  2212. transferred through the Command / Data Out Port. The host adapter then sends 
  2213. (Echos) the same data value back to the host through the Data In Port. After 
  2214. the host has read the data value provided on the Data In Port, the host adapter 
  2215. will generate the HACC interrupt to indicate normal command completion. 
  2216.  
  2217. Byte 0, Out   Outbound Echo Value
  2218. Byte 0, In    Returned Echo Value
  2219.  
  2220. 5.2 MAILBOX OVERVIEW
  2221.  
  2222. The AHA-1540A/1542A uses a mailbox architecture for task communication between 
  2223. the host and the host adapter when executing SCSI commands. This allows the 
  2224. host adapter to perform multithreaded operations with a minimum of host 
  2225. intervention. The mailboxes are located in main system memory. Each mailbox 
  2226. entry is four bytes long. At power up, the host issues an initialization 
  2227. command to inform the host of the mailbox location. There are always an equal 
  2228. number of Outgoing Mailboxes (MBO) and Incoming Mailboxes (MBI). The MBIs are 
  2229. located immediately after the MBOs. Initiator operations and target operations 
  2230. use the same mailboxes. Both initiator and target operations may be in process 
  2231. at the same time. A typical mailbox structure is shown below. 
  2232.  
  2233. In this example, there are four MBOs and four MBIs. The Mailbox Count in the 
  2234. Mailbox Initialization command was set to four. The base address is the address 
  2235. specified by the Mailbox Address field. 
  2236.  
  2237. Note: The Adaptec BIOS initializes the AT DMA controller to accommodate Bus 
  2238. Master DMA. If the host adapter BIOS is removed or disabled, the host DMA 
  2239. controller must be initialized, via software, for Bus Master DMA operation. See 
  2240. section 5.5. 
  2241.  
  2242. 5.2.1 Mailbox Out Definition
  2243.  
  2244. The first byte of each MBO contains the Mailbox status byte. The remaining 
  2245. three bytes contain an address pointer to the first byte of a Command Control 
  2246. Block (CCB). The CCB provides additional task control information. A MBO is 
  2247. free if the first byte is zero. The host can make an entry in any free MBO and 
  2248. indicate that it is filled out or completed by placing the proper MBO command 
  2249. in the first byte of the MBO. After the MBO has been examined by the host 
  2250. adapter and all relevant information obtained by the host adapter, the host 
  2251. adapter sets the MBO command byte back to zero to allow the host to fill it 
  2252. again. For a multitasking operating system, it is desirable that the number of 
  2253. mailboxes be sufficient to allow at least one mailbox for each active 
  2254. independent task or activity. 
  2255. The MBO format is described in detail below:
  2256.  
  2257. Byte 0 MBO Command  This byte specifies the state of the MBO entry.
  2258.  
  2259. Value         Definition
  2260.  
  2261. 00H        Mailbox Out is free
  2262. 01H        SCSI or Host Adapter command is to be started. CCB pointer 
  2263.            indicates location of CCB to be processed.
  2264. 02H        SCSI or Host Adapter command is to be aborted. CCB pointer indicates
  2265.            location of CCB to be terminated.
  2266. Byte 1     CCB Pointer (MSB)
  2267. Byte 2     CCB Pointer
  2268. Byte 3     CCB Pointer (LSB)
  2269.  
  2270. The use of Mailbox Out (MBO) entries to pass pointers to CCB's is identical for 
  2271. target and initiator modes. The appropriate target mode CCB may be prepared 
  2272. early and posted to the host adapter in preparation for an operation that is 
  2273. expected to happen. If a SCSI operation occurs before the CCB is prepared, the 
  2274. host adapter processes as much of the transaction as possible, then requests a 
  2275. CCB from the host through the MBI. The host is fully responsible for preparing 
  2276. the correct CCB from the information provided through the MBI. 
  2277.  
  2278. In target mode, one CCB may be presented for each unique combination of LUN, 
  2279. Initiator, and direction. If a second CCB to the same LUN and initiator with 
  2280. the same direction bit is sent to the AHA-1540A/1542A, the CCB will be returned 
  2281. with a host status of 19H, Duplicate CCB Received. 
  2282.  
  2283. Initiator type CCB's may be queued for an LUN and Target. The host adapter will 
  2284. always search for new MBO entries in a round-robin order, beginning with the 
  2285. entry after the last MBO entry that was processed. By always placing the MBO 
  2286. entries in  the MBO area consecutively, the host can assure that the SCSI 
  2287. commands will be started with a minimum scan overhead. Initiator CCB queueing 
  2288. must be used with caution, since under some circumstances it is possible for 
  2289. CCB's to be executed out of order. 
  2290.  
  2291. If the Mailbox Out Available Interrupt is enabled by execution of Adapter 
  2292. Command 05 (Enable Mailbox Out Available Interrupt), the host adapter will take 
  2293. one of the following actions after each MBO entry is freed by the host adapter: 
  2294.  
  2295. 1)If the Any Interrupt bit in the Interrupt Flag Port is zero, indicating that 
  2296. there are no interrupts pending, the host adapter will set the Mailbox Out 
  2297. Available Interrupt and the Any Interrupt bit and indicate a hardware interrupt 
  2298. to the host. 
  2299.  
  2300. 2)If the Mailbox Out Available Interrupt has been set to one by the previous 
  2301. clearing of a Mailbox Out entry and the interrupt has not yet been cleared by 
  2302. the host, the host adapter will not change the MBOA interrupt bit and will 
  2303. continue to scan for other stored MBO entries. 
  2304.  
  2305. 3)If interrupts other than the Mailbox Out Available Interrupt are pending, the 
  2306. host adapter will wait for the pending interrupts to be cleared before setting 
  2307. the Mailbox Out Available Interrupt. This guarantees that the MBO Available 
  2308. Interrupt will not be cleared accidentally by clearing another interrupt. 
  2309.  
  2310.  
  2311. 5.2.2 Mailbox In Definition
  2312.  
  2313. The Mailbox In entries are used to pass completion information concerning a 
  2314. task from the host adapter to the host. In addition, requests for Target Mode 
  2315. CCB's are passed to the host using MBI entries. The first byte of each MBI 
  2316. contains the MBI Status byte, summarizing the type of information being passed 
  2317. from the host adapter to the host. The remaining three bytes contain 
  2318. specialized information that provides more detail about the information. In the 
  2319. case of a CCB Completed MBI, the bytes contain a pointer to the completed CCB. 
  2320. In the case of a CCB Required MBI, the bytes contain the information necessary 
  2321. for the host to prepare an appropriate CCB. Only those MBI's with a MBI Status 
  2322. that is non-zero have information for the host. When the host returns the MBI 
  2323. Status byte to zero, the MBI Free state, the host adapter is allowed to place a 
  2324. new set of information in the MBI entry. 
  2325.  
  2326. When a SCSI command completes or if a new CCB is required, the host adapter 
  2327. scans the first byte of an MBI entry to find a free mailbox. If one is found, 
  2328. the host adapter will update the MBI's status byte with a non zero value and 
  2329. update the following bytes with the appropriate required pointers or 
  2330. parameters. The valid MBI formats are defined below: 
  2331.  
  2332. Mailbox In Format for CCB Complete
  2333.  
  2334. Byte 0        MBI Status-This byte specifies the state of the MBI entry.
  2335. Value         Definition
  2336. 00H           Mailbox In is free
  2337. 01H           CCB completed without error. CCB pointer indicates location of
  2338.               successfully completed CCB. 
  2339. 02H           CCB aborted by host. CCB pointer indicates location of CCB that
  2340.               was aborted.
  2341. 03H           Aborted CCB not found. CCB pointer indicates the supposed location
  2342.               of the CCB that was to have been aborted. It is likely that the 
  2343.               CCB was already presented to the host before the Abort  CCB MBO
  2344.               entry was completed.
  2345. 04H           CCB Completed with Error. The CCB fields indicate the details of
  2346.               the error condition. This code allows normal CCB completion to be
  2347.               processed without bothering to examine the completion codes in 
  2348.               the CCB. 
  2349. Byte 1        CCB Pointer (MSB)
  2350. Byte 2        CCB Pointer
  2351. Byte 3        CCB Pointer (LSB)
  2352.  
  2353. Mailbox In Format for CCB Required
  2354. Byte 0       MBI Status    This byte specifies the state of the MBI entry.
  2355. Value        Definition
  2356. 10H          SCSI Target Command received with no CCB available. The host must
  2357.              prepare an appropriate CCB and place it in the MBO to complete the
  2358.              SCSI command. The remaining three bytes of the MBI specify the 
  2359.              information necessary to prepare a SCSI command.
  2360. Byte 1       Initiator and LUN
  2361. Bit 7-5      Binary address of initiator that selected the host adapter in 
  2362.              Target Mode.
  2363. Bit 4        The SCSI Target Command received was a RECEIVE command. A CCB must
  2364.              be prepared to transmit data to the Initiator.
  2365. Bit 3        The SCSI Target Command received was a SEND command. A CCB must be
  2366.              prepared to transmit data from the Initiator.
  2367. Bits 2-0     Binary address of the logical unit of the Target Mode host adapter
  2368.              that was addressed by the Initiator.
  2369. Byte 2-3     Data Length The high order two bytes of the data length specified
  2370.              in the SEND  or the RECEIVE command. A CCB must be prepared to 
  2371.              transmit this amount of data plus up to 256 more bytes. It is 
  2372.              assumed that the data fields are self-defining or of a known length
  2373.              in such protocols.
  2374.  
  2375. The CCB Required Mailbox In entries are only generated when a command has been 
  2376. received by the host adapter in target mode. For the CCB Required Mailbox In 
  2377. entries, byte 0 takes on a distinctive value of 10H, indicating both that the 
  2378. MBI entry is filled and that the MBI entry is being presented to request a CCB 
  2379. appropriate to service a SCSI transaction for which no CCB was available. The 
  2380. host adapter will have disconnected on the SCSI after receiving the initiator 
  2381. and LU addresses and after having received either a SCSI SEND or a RECEIVE 
  2382. command. If the LU address is enabled by the Logical Unit Mask, the MBI will 
  2383. provide the addresses in bits 7-5 and bits 2-0 and will indicate by setting 
  2384. either bit 3 or bit 4 that a SCSI SEND or RECEIVE command was accepted from the 
  2385. initiator. The host system is then expected to prepare a CCB suitable for 
  2386. processing the Send or Receive command. The information in bytes 2 and 3 is a 
  2387. copy of bytes 2 and 3 of the Send or Receive command CDB. This provides the 
  2388. host  an approximation of the length of the requested data transfer. This 
  2389. length is used by the host to allocate the correct amount of buffer to accept 
  2390. data in a SEND command or to control the maximum amount of data that can be 
  2391. transferred in a RECEIVE command. If the LU address received is disabled,  no 
  2392. MBI will be presented and a check condition will be posted to the Initiator. A 
  2393. subsequent REQUEST SENSE command will recover an Invalid LUN error indication. 
  2394.  
  2395. After each Mailbox In entry is stored by the host adapter, it will indicate 
  2396. that Mailbox In scanning must be performed in the following manner: 
  2397.  
  2398. 1)-If the Any Interrupt bit is not set to one in the Interrupt Flag port, 
  2399. indicating that no interrupts are pending, the host adapter will set the 
  2400. Mailbox In Full interrupt bit, the Any Interrupt bit, and raise the hardware 
  2401. interrupt line to indicate that there is at least one Mailbox In entry to be 
  2402. examined by the host system. 
  2403.  
  2404. 2)-If the Mailbox In Full interrupt bit has already been set to indicate that 
  2405. an entry was made in the Mailbox In area and if that interrupt has not yet been 
  2406. cleared by the host, no further notification is provided by the host adapter. 
  2407.  
  2408. 3)-If interrupts other than the Mailbox In Full interrupt are pending, the host 
  2409. adapter will wait for all pending interrupts to be cleared before setting the 
  2410. Mailbox In Full interrupt. 
  2411.  
  2412. Note that careful host Target Mode software design is necessary to prevent 
  2413. ambiguity in the notification process. If a CCB was just prepared but the MBO 
  2414. has not yet been searched by the host adapter at the time the MBI entry is made 
  2415. to the host, the host may choose to examine the MBI entry and not act on it, 
  2416. having already provided the needed CCB. The host should also examine the entire 
  2417. MBI space to be sure that a previously supplied CCB which should have been able 
  2418. to service the notification MBI entry was not already used for a previous 
  2419. operation that had been posted by the host adapter but not yet serviced by the 
  2420. host. Proper care in host system design will prevent these overlapping 
  2421. operations from becoming a problem. 
  2422.  
  2423. 5.3 COMMAND BLOCK DEFINITION
  2424.  
  2425. The CCB specifies detailed information about a SCSI command. The format of a 
  2426. CCB is shown below. Each of the fields is separately explained following the 
  2427. table. 
  2428.  
  2429. COMMAND CONTROL BLOCK FORMAT
  2430.  
  2431.  
  2432. Byte 0    Command Control Block Operation Code
  2433. Value       Definition
  2434. 00H       SCSI Initiator Command
  2435. 01H       Target Mode Command
  2436. 02H       SCSI Initiator Command with Scatter/Gather
  2437. 81H       Bus Device Reset
  2438.  
  2439. Byte 1   Address and Direction Control 
  2440. Bits 7-5   CCB Op Code = 00, 02:  SCSI Target Id 
  2441.            CCB Op Code = 01:     SCSI Initiator Id
  2442. Bit   4    Outbound data transfer, length is checked.
  2443. Bit   3    Inbound data transfer, length is checked.
  2444. Bit  2-0   Logical Unit Number
  2445. Byte 2     SCSI Command Length
  2446. Byte 3     Request Sense Allocation Length/Disable Auto Sense
  2447. Byte 4-7   Data Length (Byte 4 most significant)
  2448. Byte 7-9   Data Pointer (Byte 7 most significant)
  2449. Byte 10-12 Link Pointer (Byte 10 most significant)
  2450. Byte 13    Command Linking Identifier
  2451. Byte 14    Host Adapter Status  (HASTAT)
  2452. Byte 15    Target Device Status  (TARSTAT)
  2453. Byte 16-17 Reserved (00)
  2454. Byte 18-n  SCSI Command Descriptor Block
  2455.            (Length specified by byte 2)
  2456. Byte n-m   Reserved for REQUEST SENSE information bytes
  2457.            (Length of reserved space in byte 3)
  2458.  
  2459. The standard format of the Command Control Block is shown in the following 
  2460. diagram: 
  2461.  
  2462. The bytes of the CCB are defined further below:
  2463. Byte 0: Command Control Block Operation Codes
  2464. The AHA-1540A/1542A supports four CCB Operation Codes. The valid command values 
  2465. are shown below: 
  2466.  
  2467. 00  SCSI Initiator Command Control Block
  2468. 01  SCSI Target  Command Control Block
  2469. 02  SCSI Initiator Command Control Block with Scatter/Gather
  2470. 81  SCSI Bus Device Reset
  2471.  
  2472. If the Operation Code value is 00H, the SCSI command specified in the Command 
  2473. Descriptor Block field of the CCB is executed against the addressed Target  / 
  2474. LUN. The other fields of the CCB support the required Initiator functions of 
  2475. the AHA-1540A/1542A. 
  2476.  
  2477. If the Operation Code value is 01H, the CCB is intended to service a SEND or 
  2478. RECEIVE command sent to the host adapter as a target from another initiator. 
  2479. The values in the other fields are used to service the Target Mode operation. 
  2480. If an Operation Code of 01H is specified to a host adapter that has not had its 
  2481. Target Mode enabled, the host adapter returns a Host Status indication of 18H, 
  2482. Invalid CCB Parameter. 
  2483.  
  2484. If the Operation Code value is 02H, the SCSI command specified in the Command 
  2485. Descriptor Block field of the CCB is executed against the addressed Target / 
  2486. LUN. The definition of the Data Length and the Data Pointer is modified to 
  2487. support the Scatter/Gather function. Refer to section 5.2.4. 
  2488.  
  2489. If the value is 81(hex) a Bus Device Reset message will be sent to the 
  2490. addressed target. This command forces the host adapter to abort all outstanding 
  2491. tasks against the selected target. All remaining CCB Bytes are ignored. The 
  2492. host adapter will generate a Bus Device Reset message out to the specified 
  2493. target. 
  2494.  
  2495. Any other command value generates a Host Adapter Detected Error (Host Status 
  2496. byte of 16H). 
  2497.  
  2498.  
  2499. Byte 1: Address and Control Byte
  2500.  
  2501. This byte identifies the address of the devices that will be serviced and 
  2502. provides information about the expected direction of data flow. 
  2503.  
  2504. If the CCB is an Initiator CCB, this byte identifies the target SCSI device in 
  2505. bits 7,6, and 5. If the CCB is a Target CCB, the byte identifies the initiator 
  2506. which the CCB will serve. 
  2507.  
  2508. Bits 4 and 3 are set to determine the direction of data transfer. For an 
  2509. Initiator CCB, if neither bit is set, the direction of data transfer will be 
  2510. established by the SCSI command being executed.  For a Target CCB, if neither 
  2511. bit is set or both bits are set, the CCB will be returned with an indication of 
  2512. Invalid CCB Parameters (18H) in the Host Status field, since each Target CCB 
  2513. must be identified as to whether it will service a SEND or a RECEIVE command. 
  2514. If both bits are set for an initiator CCB,  the command must perform no data 
  2515. transfer. If only bit 3 is active, the data transfer will be to the host 
  2516. adapter and from the external SCSI device. If the CCB is a target CCB, the data 
  2517. transfer will be required to be a Data Out phase, while if the CCB is an 
  2518. initiator CCB, the data transfer will be required to be a Data In phase. If 
  2519. only bit 4 is active, the data transfer will be from the host adapter and to 
  2520. the external SCSI device. If the CCB is a target CCB, the data transfer must be 
  2521. a Data In phase, while if the CCB is an initiator CCB, the data transfer will 
  2522. be a Data Out phase. 
  2523.  
  2524. If bits 3 or 4 are set for an Initiator CCB, the data length will be checked. 
  2525. If the amount of data transferred exceeds the specified amount, the CCB Host 
  2526. Status field will contain an indication of Data Over/Under Run (12H). For a  
  2527. Processor Target mode CCB, the handling of incorrect lengths is described in 
  2528. Section 8.2.4. 
  2529.  
  2530. If a data underrun/overrun condition occurs for an operation that accesses the 
  2531. drive's media (READ/WRITE, EXTENDED READ/WRITE, WRITE AND VERIFY) and the 
  2532. direction bits are set to zero, the host adapter will complete the operation 
  2533. without error. However, some or all of the data specified by the host may not 
  2534. be transferred. 
  2535.  
  2536. CAUTION:  THE APPROPRIATE DIRECTION BIT SHOULD BE SET FOR ALL OPERATIONS THAT 
  2537. ACCESS THE DRIVE'S MEDIA. 
  2538.  
  2539. If the CCB is an initiator CCB, bits 2,1, and 0 define the target Logical Unit 
  2540. which will be addressed. If the target accepts an IDENTIFY message out, the 
  2541. value in bits 2,1, and 0 will be provided in the LUN field of the message byte. 
  2542. The LUN field in the SCSI Command Descriptor Block (CDB) is expected to be 
  2543. zero. If the target does not accept an IDENTIFY message out, the LUN field in 
  2544. the SCSI CDB must contain the correct Logical Unit address. SCSI devices with 
  2545. conformance level 2, including Common Command Set (CCS) disk drives and all 
  2546. SCSI-2 devices will always accept the IDENTIFY message out. The few SCSI 
  2547. devices not meeting those requirements must be examined on a case by case basis 
  2548. to determine whether the Logical Unit Address should be placed in CCB Byte 1 or 
  2549. in the CDB. 
  2550.  
  2551. This enables the host adapter to check the length of the data transfer and if a 
  2552. data underrun/overrun condition occurs, the CCB will be returned with an 
  2553. indication of Data Underrun/Overrun (12H) in the Host Status field. For 
  2554. operations that do not access the drive's media, the direction bits should be 
  2555. set to zero unless transfer length checking is desired. Setting both direction 
  2556. bits to one should be used only when no data transfer is expected or 
  2557. suppression of data transfer is desired for READ operations. 
  2558.  
  2559. Byte 2: SCSI Command Length
  2560.  
  2561. This byte establishes the length, in bytes, of the SCSI Command Descriptor 
  2562. Block. 
  2563.  
  2564. Byte 3: Request Sense Allocation Length
  2565.  
  2566. When a SCSI device terminates an operation with CHECK CONDITION status, it 
  2567. means that the device has error or status information as a result of execution 
  2568. of the operation. The SCSI specification indicates that a REQUEST SENSE command 
  2569. must be executed before any other command is executed in order for the host 
  2570. initiator to be sure of obtaining the error information. Since the AHA-154XA 
  2571. host adapter has the capability of queueing commands for execution, the host 
  2572. adapter itself must take charge of generating the Request Sense command. The 
  2573. automatic generation of Request Sense is inconvenient for some specialized 
  2574. operating systems, so the function can be disabled by installation of a jumper 
  2575. in J9 (See section 3.3.11). If the jumper is not installed, the function can 
  2576. also be disabled by specifying a value of 01H for the Request Sense Allocation 
  2577. Length. 
  2578.  
  2579. This byte indicates the length, in bytes, of the area reserved for information 
  2580. that may be obtained by a REQUEST SENSE command. A value of 00H indicates that 
  2581. an allocation length of 14 bytes is to be used, sufficient to capture the sense 
  2582. key and error code of all normal extended sense type devices. A value of 01H 
  2583. requests that no automatic REQUEST SENSE be executed. The values from 02H to 
  2584. 07H are reserved. Values from 08H to FFH are valid allocation lengths. The 
  2585. value is used to notify the host adapter that the specified number of bytes 
  2586. have been reserved at the end of the CCB to receive possible Request Sense data 
  2587. bytes. The REQUEST SENSE also uses the indicated allocation length as its byte 
  2588. count in the Command Descriptor Block generated by the host adapter. 
  2589.  
  2590. If an operation that treats the AHA-1540A/1542A as a Target Mode device fails 
  2591. and presents a Check Condition status byte,  the Initiator should return a 
  2592. REQUEST SENSE command. The AHA-1540A/1542A will return appropriate sense 
  2593. information in response to the command. If the command that originally failed 
  2594. was a SEND or a RECEIVE command, the same REQUEST SENSE information bytes that 
  2595. will later be sent to the Initiator are also sent to the host when the CCB is 
  2596. returned. The sense information is placed in the specified Request Sense 
  2597. Allocation area with a length not exceeding the Request Sense Allocation 
  2598. Length. 
  2599.  
  2600. Bytes 4, 5, 6: Data Length
  2601.  
  2602. These bytes determine the length, in bytes, of the data transfer. CCB host 
  2603. adapter error 12(hex) is posted if a data over run occurs. 
  2604.  
  2605. If the CCB specifies a Scatter/Gather operation, the Data Length field contains 
  2606. the total number of bytes in the Data Segment List. 
  2607.  
  2608. Bytes 7, 8, 9 : Data Pointer
  2609.  
  2610. These bytes specify the real address of the first byte of the data area to be 
  2611. used during the data phase of the SCSI command. 
  2612.  
  2613. If the CCB specifies a Scatter/Gather operation, the Data Pointer field 
  2614. contains the pointer to the first byte of the Data Segment List. 
  2615.  
  2616. Bytes 10, 11, 12: Link Pointer
  2617.  
  2618. These bytes are used when a SCSI command contains a LINK or LINK WITH TAG bit  
  2619. in the command. When a Linked command is completed, the host adapter will use 
  2620. the contents of this field as a pointer to the next CCB to execute. If the 
  2621. Linked Flag bit is set, an interrupt will be generated before the next command 
  2622. is started. A completed CCB is always reported back in an MBI, but MBIF 
  2623. interrupts are only reported if the linked set of commands is finished or if a 
  2624. Link with Flag message is presented. There must be enough MBI entries to 
  2625. receive the entire set of linked commands. 
  2626.  
  2627. Target Mode does not support the linking function. 
  2628.  
  2629. Byte 13 : Command Link ID
  2630.  
  2631. This byte is used in conjunction with linked commands. It is set by the host to 
  2632. identify commands in a command chain. 
  2633.  
  2634. Linking is not supported in Target Mode. 
  2635.  
  2636. Byte 14 : Host Status
  2637.  
  2638. This byte is used to report the host adapter status (HASTAT). 
  2639.  
  2640. HASTAT has the following definitions:
  2641.  
  2642. 00 H No host adapter detected error-The CCB was completed normally.
  2643. 0A H Linked command complete without error-The SCSI command 
  2644.                                            completed and linked normally.
  2645. 0B H Linked command complete without error, interrupt generated.-The SCSI
  2646.  command completed and linked with a LINKED COMMAND COMPLETE WITH FLAG message.
  2647. 11 H Selection time out-The initiator selection or target reselection was not 
  2648.    complete within the Set SCSI Selection Time-out period. 
  2649. 12 H Data over run/Under run-The target attempted to transfer more data than 
  2650.    was allocated by the Data Length field or the sum of the Scatter / Gather 
  2651.    Data Length fields. 
  2652. 13 H Unexpected bus free-The target dropped the SCSI BSY at an unexpected time. 
  2653. 14 H Target bus phase sequence failure-An invalid bus phase or bus phase 
  2654.    sequence was requested by the target. The host adapter will generate a SCSI 
  2655.    Reset Condition, notifying the host with a SCRD interrupt. 
  2656. 15 H MBO command was not 00, 01, or 02-The first byte of the MBO command was 
  2657.    invalid. This usually indicates a software failure. 
  2658. 16 H Invalid CCB Operation Code-The first byte of the CCB was invalid. This 
  2659.     usually indicates a software failure. 
  2660. 17 H Linked CCB does not have the same LUN-A subsequent CCB of a set of linked 
  2661.    CCB's does not specify the same logical unit number as the first. 
  2662. 18 H Invalid Target Direction received from Host-The direction of a Target Mode 
  2663.    CCB was invalid. 
  2664. 19 H Duplicate CCB Received in Target Mode-More than once CCB was received to 
  2665.    service data transfer between the same target LUN and initiator SCSI ID in 
  2666.    the same direction. 
  2667. 1A H Invalid CCB or Segment List Parameter-A segment list with a zero length 
  2668.    segment or invalid segment list boundaries was received. A CCB parameter was 
  2669.    invalid. 
  2670.  
  2671. Byte 15: Target Status 
  2672.  
  2673. For an initiator CCB, this byte is used to return the SCSI status byte sent to 
  2674. the host adapter from the initiator. If a SCSI command returns with BUSY 
  2675. status, the normal recovery process is to execute the command again. The AHA-
  2676. 154XA takes that burden off the host and periodically restarts the command 
  2677. automatically until the command completes with a status other than Busy. 
  2678.   
  2679. For a target mode CCB, this byte is used to indicate to the host what status 
  2680. the host adapter returned to the initiator. 
  2681.  
  2682. Target Status may have the following values in target mode 
  2683.  
  2684. 00 -- Good Status
  2685. 02 -- Check Status (See REQUEST SENSE byte area)
  2686. 08 -- LUN Busy
  2687.  
  2688. Byte 16: Reserved (must be 0)
  2689.  
  2690. Byte 17: Reserved (must be 0)
  2691.  
  2692. Byte 18: n: SCSI Command Descriptor Block
  2693.  
  2694. This field holds the SCSI Command Descriptor Block (CDB) as described in the 
  2695. SCSI specification. The length of this command is described in byte 02. For 
  2696. initiator mode CCB's, the CDB provided by the host is transmitted to the 
  2697. target. For target mode CCB's, the CDB provided from the initiator is returned 
  2698. to the host in this space. 
  2699.  
  2700. Byte 18+n - 18+n+m : Allocated for Sense Data
  2701.  
  2702. If a Check Status condition is detected by the AHA-154XA as it completes an 
  2703. operation on the SCSI bus,  the host adapter automatically executes a REQUEST 
  2704. SENSE command with the data length specified by Request Sense Allocation 
  2705. Length. The actual bytes returned, up to the maximum indicated by the Request 
  2706. Sense Allocation Length, are placed in the area Allocated for Sense Data. If 
  2707. the Request Sense Allocation Length was 01h, no REQUEST SENSE command is 
  2708. executed. 
  2709.  
  2710. If a check condition is detected by the AHA-154XA while it is operating in 
  2711. Processor Target Mode, the same information that will later be recovered by the 
  2712. initiator that received the Check Status is also placed in the area Allocated 
  2713. for Sense Data so that the host processor is also aware of the failure. 
  2714.  
  2715.  
  2716. 5.3.1 SCATTER/GATHER LIST DEFINITION
  2717.  
  2718. Using the normal CCB Operation Codes of 00 and 01 (SCSI Initiator and SCSI 
  2719. Target CCB's), the CCB itself contains a pointer to the first byte of a 
  2720. contiguous area of data of a specified length. The direction of transfer with 
  2721. respect to the data area and the checking of the length of the data transfer to 
  2722. the data area are both managed by the AHA-1540A/1542A according to the 
  2723. requirements of the particular mode and control bit set-up. 
  2724.  
  2725. Using the Scatter/gather Operation Code of 02, the CCB instead contains a 
  2726. pointer to a list of data segments and an indication of the length of the list 
  2727. of data segments. The data segment list contains pointers to the actual 
  2728. location in host memory of the data segments to be transferred as well as a 
  2729. precise indication of the length of each data segment. Each data segment list 
  2730. entry contains a three-byte pointer to the location of a data segment and 
  2731. three-byte length indicator telling how long that particular data segment shall 
  2732. be. The data segment list is arranged in the order in which data will be 
  2733. gathered or distributed, the first pointer in the list being used first. 
  2734.  
  2735. A typical data segment list is shown in the following table. The data segment 
  2736. list describes the distribution of 4096 bytes distributed in four separate 
  2737. locations within the memory. The beginning of the data segment list is 
  2738. indicated by the data segment list pointer. The length of the data segment list 
  2739. (24 bytes) will be contained in the data segment list length field of the CCB. 
  2740.  
  2741. A data segment list can have from one to sixteen segments. A list with 0 
  2742. segments or a list with more than 16 segments causes an Invalid Segment List 
  2743. error to be posted in the host status field. 
  2744.  
  2745. The AHA-154XA has certain constraints in the data segment address boundaries 
  2746. and lengths that are allowed. If these boundaries are violated, an Invalid 
  2747. Segment List error will be posted in the host status field of the CCB. The 
  2748. simplest way to assure that these boundaries are not violated is to require all 
  2749. boundaries between segments to be on even word boundaries. The first segment 
  2750. may begin on any boundary and the last segment may end on any boundary. All 
  2751. segments but the first and last should have even byte counts. 
  2752.  
  2753. The actual boundary limitation is somewhat less restrictive. If the binary 
  2754. values of the starting address of a segment, the byte count of that segment, 
  2755. and the starting address of the next segment are all exclusive OR'd together, 
  2756. and the result of that exclusive or is an even number, the boundary between 
  2757. those two segments is valid. Another way to express the limitation is to 
  2758. require that the ending boundary of one segment must be the same as the 
  2759. beginning boundary of the next segment. If a segment ends on a word boundary, 
  2760. the next segment must begin on a word boundary. Similarly, if a segment ends on 
  2761. an odd-byte boundary, the next segment must begin on an odd-byte boundary. 
  2762.  
  2763.  
  2764. 5.4 DESCRIPTION OF OPERATION 
  2765.  
  2766. This section describes the interface operations required to invoke the desired 
  2767. SCSI behavior. The AHA-1540A/1542A must be properly initialized before any of 
  2768. these operations can be performed. 
  2769.  
  2770. After system initialization is done, the I/O Command Port initialization 
  2771. commands must be executed. The Mailbox Initialization command must be executed 
  2772. to assign the Mailbox area. The Enable Target Mode command may optionally be 
  2773. executed if Target Mode is to be allowed. 
  2774.  
  2775. 5.4.1 Execution of Initiator Mode operations 
  2776.  
  2777. To begin an Initiator Mode SCSI command, the host first allocates a data buffer 
  2778. area. A CCB is then created to perform the desired operation to the correct 
  2779. peripheral device and a pointer to the data buffer area is placed in the CCB. 
  2780. Once the CCB is completely defined, the host places a pointer to the CCB in an 
  2781. empty MBO location, places an MBO full status in the MBO status byte, and 
  2782. transmits a Start SCSI Command to the I/O Command Port. If it is not already 
  2783. scanning the MBO for an active MBO entry, the Start SCSI Command to the I/O 
  2784. Port causes the host adapter to begin scanning for such an entry. 
  2785.  
  2786. After finding an active MBO entry, the AHA-1540A/1542A copies the MBO Command 
  2787. field contents and CCB pointer into its internal RAM and clears the MBO Command 
  2788. byte, freeing the mailbox. Up to 16 initiator CCBs and 16 target CCBs can be 
  2789. stored in the host adapter's internal RAM concurrently. The AHA-1540A/1542A 
  2790. maximizes the SCSI bus utilization by starting the next available CCB as soon 
  2791. as the bus is free. Disconnection  and reconnection on the bus are 
  2792. automatically taken care of by the AHA-1540A/1542A. As the host adapter starts 
  2793. the SCSI operation, it  will first determine if the addressed target/LUN is 
  2794. busy. If the target/LUN is busy, then the command will be placed in the task 
  2795. queue to be tried again later. 
  2796.  
  2797. Commands are removed from the queue in the order that they were received, 
  2798. establishing a (FIFO) first in first out command execution order. Of course, 
  2799. the order of task completion may vary due to the different amounts of time 
  2800. required to process and complete different commands. If the target/LUN is not 
  2801. busy, the new command is started at the next bus free phase. If BUSY status is 
  2802. received by the AHA-1540A/1542A, the CCB is placed at the end of the FIFO queue 
  2803. to be restarted later. 
  2804.  
  2805. If a CHECK CONDITION status is received from the target, the AHA-1540A/1542A 
  2806. will issue a Request Sense command to get the sense data. The sense data is 
  2807. stored in the CCB after the SCSI command data. The driver software must reserve 
  2808. the allocated number of bytes at the end of the CCB to hold the sense data 
  2809. which is returned as result of a receiving a check status. Automatic Request 
  2810. Sense can be optionally disabled by jumpers or by using the CCB. 
  2811.  
  2812. If the MBO Command is to abort a SCSI command, the host adapter first searches 
  2813. the active and queued CCBs. If the CCB is found, the task is aborted at the 
  2814. earliest possible moment and an MBI entry is made to indicate that the CCBs 
  2815. execution was successfully terminated. If the CCB is not found among the active 
  2816. or queued CCBs, the AHA-1540A/1542A completes the command and reports that fact 
  2817. in the MBI Status byte.  The CCB may not be found because it has previously 
  2818. been aborted, because an intervening reset occurred, or because the CCB was 
  2819. already finished normally and returned. 
  2820.  
  2821. The AHA-1540A/1542A scans the MBOs in a round robin fashion. This is to ensure 
  2822. that all of the mailboxes will be scanned with equal probability. A host can 
  2823. minimize the AHA-1540A/1542A MBO scan time by using MBO's sequentially. 
  2824.  
  2825. When executing a START SCSI command, the AHA-1540A/1542A does not verify that 
  2826. the new CCB resides in an unused memory area. Therefore, the host must not 
  2827. reuse a CCB location until it has been returned through a Mailbox In entry and 
  2828. the host has examined all the pertinent information in the CCB.  CCB addresses 
  2829. are used by the AHA-1540A/1542A as task identifiers. 
  2830.  
  2831. 5.4.2 Execution of Target Mode Operations
  2832.  
  2833. 5.4.2.1 Target Mode with a Prepared CCB
  2834.  
  2835. Typical target operation is managed in the following way by the host software. 
  2836. After power-on initialization is complete, the host sends an Enable Target Mode 
  2837. command to the host adapter to enable Processor Target mode. After that, the 
  2838. host, from previous configuration knowledge, generates a pair of CCB's for each 
  2839. likely initiator and for each LUN supported by the host. One CCB is for 
  2840. outbound data from the initiator using the SEND command, while the other is for 
  2841. inbound data from the target to the initiator using the RECEIVE command. The 
  2842. SEND command CCB defines a data buffer for the expected network type command 
  2843. from the initiator. The RECEIVE command CCB defines a set of data which is 
  2844. known and expected by the initiator, typically a welcome or configuration type 
  2845. message packet. The host adapter tests to be sure that duplicate CCBs are not 
  2846. provided by the host. 
  2847.  
  2848. As the initiator finishes its initialization procedure, it requests 
  2849. availability and configuration information using the TEST UNIT READY, REQUEST 
  2850. SENSE, and INQUIRY commands. Finally, it may choose to address SEND and RECEIVE 
  2851. commands to the targets it has located to transmit or request  information 
  2852. packets. 
  2853.  
  2854. When the initiator executes a SEND or a RECEIVE command, the target accepts the 
  2855. selection on the SCSI bus, accepts the command from the initiator, and executes 
  2856. the proper data transfer to or from the area specified by the proper CCB. When 
  2857. all SCSI activity is finished successfully, the CCB is posted back to the host 
  2858. program by an entry in the MBI. The host adapter updates the CCB byte count and 
  2859. CDB field contents to correctly reflect the operation performed. The host is 
  2860. notified that there is an entry in the MBI by an interrupt from the host 
  2861. adapter.  The host then prepares a new CCB to control the target's next 
  2862. activity expected from the initiator. 
  2863.  
  2864.  
  2865. 5.4.2.2 Target Mode without a Prepared CCB
  2866.  
  2867. Alternatively, the processor type device may be addressed by an initiator when 
  2868. no CCB has yet been prepared for use by the host adapter. If the host adapter 
  2869. command enabling target mode has not yet been executed, the host adapter will 
  2870. act like any initiator. It will not accept any selection sequence and any 
  2871. attempts to select it by its target ID will cause the initiator to detect a 
  2872. selection time-out. 
  2873.  
  2874. If the host adapter has been enabled as a Processor Target by a host adapter 
  2875. command, any selection to the host adapter's target address will be accepted. 
  2876. The availability commands and identification commands (TEST UNIT READY, REQUEST 
  2877. SENSE, and INQUIRY) will be executed completely and normally. If a SEND or 
  2878. RECEIVE command is received and if a CCB is not active, either because the host 
  2879. has not completed its program initialization or because the host has not 
  2880. finished analyzing the results of previous data transfers and has not generated 
  2881. a new CCB, the Processor Target will accept the selection, obtain the IDENTIFY 
  2882. Message Out to determine what Logical Unit has been selected, request the CDB 
  2883. from the SCSI, and then disconnect. The CDB will be partially interpreted so 
  2884. that the proper MBI can be generated to notify the host that a new CCB with a 
  2885. certain address, direction, and data length must be generated. When the new CCB 
  2886. is passed to the host adapter by an MBO entry, the CCB is filled up with the 
  2887. command information, the SCSI is reconnected, and the command is completed as 
  2888. described above. 
  2889.  
  2890. 5.5 DMA Channel Initialization With the Host Adapter BIOS Disabled
  2891.  
  2892. The DMA circuitry must be set to a special state to allow the Bus Master 
  2893. operation of the AHA-154XA to operate correctly. This state is normally 
  2894. established by the BIOS during initialization so that no other activity is 
  2895. required. If a DMA channel other than the default channel is being used or if 
  2896. the DMA channel is manipulated by other programs, the circuitry must be 
  2897. initialized in the following way before the AHA-154XA can be used. 
  2898.  
  2899. For the DMA channel being used, 2 bytes of data must be written to the DMA 
  2900. controller port specified to initialize the Host DMA controller for Bus Master 
  2901. DMA operation. The following table specifies these values in HEX. 
  2902.  
  2903. DMA Channel       DMA Controller Port    Data
  2904.  0                       0B               0C
  2905.                          0A               00
  2906.  
  2907.  5                       D6               C1
  2908.                          D4               01
  2909.  
  2910.  6                       D6               C2
  2911.                          D4               02
  2912.  
  2913.  7                       D6               C3
  2914.                          D4               03
  2915.  
  2916.  
  2917. 5.6 INTERRUPT INITIALIZATION
  2918.  
  2919. This setup procedure is normally completed by the BIOS during initialization so 
  2920. that no other activity is required. If modifications to the interrupt handler 
  2921. are required, this information together with the programming information 
  2922. provided by the host system should be sufficient to properly set up the 
  2923. interrupt vectors. 
  2924.  
  2925. The host adapter will drive one of several interrupts in the AT system. The 
  2926. particular interrupt used must be set up on power up initialization and be 
  2927. properly managed during usage. The AT interrupts of interest to the host 
  2928. adapter driver along with their corresponding vector locations are summarized 
  2929. below. All these interrupst are handled by a slave interrupt controller. The 
  2930. master controller handles all system interrupts such as keyboard, timer, etc. 
  2931. and is assumed to be correctly initialized to allow interrupts by the slave 
  2932. controller. Upon receiving an interrupt, the processor will be vectored to the 
  2933. contents of the corresponding vector location. 
  2934.  
  2935. Hardware   Software interrupt
  2936. interrupt  vector location (hex)
  2937.  
  2938. int 9    --     INT71
  2939. int 10   --     INT72
  2940. int 11   --     INT73
  2941. int 12   --     INT74
  2942. int 13   --     INT76
  2943. int 14   --     INT77
  2944. int 15   --     INT78
  2945.  
  2946. The interrupt is initialized by clearing the corresponding interrupt mask bit 
  2947. in the slave controller. The mask register is a read/write register, and only 
  2948. the bit of interest should be cleared. The port address is A1 hex, and bit 
  2949. definitions follow.
  2950.  
  2951. Interrupt mask bit definition (port address A1 hex)
  2952.  
  2953. bit 0 -- int 8
  2954. bit 1 -- int 9
  2955. bit 2 -- int 10
  2956. bit 3 -- int 11
  2957. bit 4 -- int 12
  2958. bit 5 -- int 13
  2959. bit 6 -- int 14
  2960. bit 7 -- int 15
  2961.  
  2962. 6.1 SINGLE THREADED BIOS COMMAND INTERFACE
  2963.  
  2964. The AHA-1540A/1542A BIOS resides on the host adapter board. It provides support 
  2965. for up to two SCSI Common Command Set disk drives under DOS. If SCSI devices 
  2966. other than CCS disk drives or if support for more than two disk drives is 
  2967. required under DOS, the Adaptec DOS Driver, ASW-1110 must be used. The BIOS 
  2968. provides a very simple single threaded capability that does not make use of the 
  2969. Mailbox Interface used by more sophisticated programs. This capability allows 
  2970. the host system to boot from a SCSI disk drive and to support standard DOS 
  2971. calls from any standard program. 
  2972.  
  2973. The BIOS communicates with the host adapter through a special set of commands 
  2974. passed under the I/O Command Port command 02H (Start Bios Command). These 
  2975. commands are not available to any programs except the Adaptec BIOS. The Adaptec 
  2976. BIOS provides a standard BIOS interface. The DOS interface to the standard BIOS 
  2977. is described in this section. 
  2978.  
  2979. On an AT compatible machine, up to two hard disks are supported by the BIOS 
  2980. resident on the mother board. Any other drives must be managed through the 
  2981. Mailbox Interface using an appropriate driver. The operation of the AHA-
  2982. 1540A/1542A BIOS on attached SCSI devices depends on the number of standard 
  2983. hard disks installed directly on the system. 
  2984.  
  2985. No standard hard disks installed: 
  2986.  
  2987. In this case, two SCSI drives can be supported by the AHA-1540A/1542A BIOS. 
  2988. SCSI Device 0 Logical Unit Number 0 is designated as drive 0 (Drive C:). Either 
  2989. SCSI Device 0 LUN 1 or SCSI Device 1 LUN 0 may be designated as drive 1 (Drive 
  2990. D:). This set of addresses allows the use of two drives with either embedded 
  2991. controllers or bridge controllers. Booting is only performed from SCSI Device 0 
  2992. LUN 0.  When no standard hard disks are installed, the AHA-1540A/1542A BIOS is 
  2993. operating in non-concurrent mode. 
  2994.  
  2995. One standard hard disk installed: 
  2996.  
  2997. In this case, the internally installed hard disk is designated as drive 0 
  2998. (Drive C:). SCSI Device 0 LUN 0 is designated as drive 1 (Drive D:). Booting is 
  2999. performed from the internally installed hard disk. This mode of operation is 
  3000. called concurrent operation, indicating that the internally installed drive and 
  3001. one SCSI drive can operate together under the BIOS. 
  3002.  
  3003. Two standard internal hard disks installed: 
  3004.  
  3005. In this case, all the disks that can be supported by the BIOS are directly 
  3006. installed. The AHA-1540A/1542A BIOS will not support any SCSI drives. Therefore 
  3007. a device driver will need to be installed to access the SCSI drives. 
  3008.  
  3009. 6.2 BIOS COMMAND EXECUTION USING INTERRUPT 13 
  3010.  
  3011. On IBM compatible systems, disk I/O requests are passed from the operating 
  3012. system to the BIOS through software interrupt 13H. CPU registers are used to 
  3013. pass information about the desired operation and the associated parameters. 
  3014.  
  3015. The AHA-1540A/1542A BIOS provides SCSI support by intercepting each interrupt 
  3016. and managing the request according to the drive address. If the drive is a 
  3017. floppy or internally installed fixed disk, the call is managed by the mother 
  3018. board BIOS with no changes. If the selected drive is a SCSI disk drive, the 
  3019. request is handled by the Adaptec BIOS resident on the AHA-1540A/1542A. For 
  3020. concurrent operation, only calls to drive 81H (D:) are handled by the AHA-
  3021. 1540A/1542A BIOS. For nonconcurrent operation, calls to both drive 80H (C:) and 
  3022. 81H (D:) are managed by the AHA-1540A/1542A BIOS. 
  3023.  
  3024. On each Interrupt 13 call, the correct host microprocessor registers are set by 
  3025. the operating system program to provide the required parameters to both the 
  3026. Adaptec BIOS and the mother board BIOS. Most commands use the registers as 
  3027. indicated in the following table. 
  3028.  
  3029. Register Function
  3030.  
  3031. AH       BIOS Function Code
  3032. AL       Number of Sectors
  3033. CH       Low Order Byte of Cylinder Number
  3034. CL       Cylinder and Sector Numbers
  3035.              Bits 7,6 High Order Cylinder Bits
  3036.              Bits 5-0 Sector Number
  3037. DH       Head Number
  3038. DL       Drive Number
  3039. ES:BX    Data Buffer Address
  3040.  
  3041. 6.2.1 Physical to Logical Address Translation
  3042.  
  3043. As shown above, the starting sector address for read, write and verify requests 
  3044. is passed as a physical address including a 10 bit Cylinder Number, an 8 bit 
  3045. Head Number, and a 6 bit Sector Number. SCSI devices are addressed by logical 
  3046. block address without regard to the physical layout of the drive. For this 
  3047. reason, all SCSI devices are defined as drives with 64 heads and 32 sectors per 
  3048. track and with the appropriate number of cylinders to provide the full capacity 
  3049. of the drive using this physical to logical translation. The SCSI logical 
  3050. address is formed by the BIOS by concatenating the values as show below: 
  3051.  
  3052. Cylinder(10 bits) || Head(6 bits) || Sector(5 bits)=SCSI Logical Block Address
  3053.  
  3054. 6.2.2 BIOS Command Return Codes
  3055.  
  3056. The BIOS command, when complete, returns control to the requesting program at 
  3057. the next instruction after the software interrupt. A return code is set in the 
  3058. Carry Flag (CF) and a status code is placed in register AH for examination by 
  3059. the requesting program.  The expected return codes placed in the Carry Flag are 
  3060. shown below. 
  3061.  
  3062. CF Contents at Return    Return Code
  3063. CF=1                     Status is non-zero. Unusual condition or error 
  3064.                          detected.
  3065. CF=0                     Status is zero. Normal command completion     occurred.
  3066.  
  3067. AH Contents at Return    Status of Operation
  3068. AH = 00H                 No error:The operation completed successfully.
  3069. AH = 01H                 Invalid Function Request:    The operation code or  an 
  3070.                          associated parameter provided by the Interrupt 13 
  3071.                          operation was not valid.
  3072. AH = 02H                 Unable to Read Address Mark: One of the following 
  3073.                          additional sense codes (SCSI ASC) was presented in the
  3074.                          sense information returned by the REQUEST SENSE 
  3075.                          command:
  3076.                              12H (No AM Found on Data Field) 
  3077.                              21H (Illegal Logical Block Address) 
  3078. AH = 03H                  Write Protect Error:    Returned SCSI ASC was:
  3079.                              27H  (Data Protect)
  3080. AH = 04H                Read Error:Returned SCSI ASC during a read operation 
  3081.                         was:
  3082.                              14H  (No Record Found)
  3083.                              16H  (Data Sync Error)
  3084. AH = 10H                Uncorrectable ECC Error in Data:  Returned SCSI ASC 
  3085.                         during a read operation was:
  3086.                               10H  (ID ECC Error)
  3087.                               11H  (Unrecovered Read Error)
  3088. AH = 11H                ECC Corrected Data Error:Returned SCSI ASC during a 
  3089.                         read operation was:
  3090.                               17H  (Recovered Read Error w/o ECC)
  3091.                               18H  (Recovered Read Error w/ ECC)
  3092. AH = 20H                General Controller Failure:A host adapter detected 
  3093.                         failure occurred or one of the following SCSI ASC's 
  3094.                         was returned:
  3095.                               01H 08H 40H 46H
  3096.                               03H 09H 41H 47H
  3097.                               05H 1BH 42H 48H
  3098.                               06H 1CH 43H 49H
  3099.                               07H 1DH 44H
  3100.  
  3101. AH = 40H               Seek Operation Failed:  Returned SCSI ASC was:
  3102.                               15H  (Seek Positioning Error)
  3103.                               02H  (No Seek Complete)
  3104. AH = 80H               Selection Time-out: A host adapter does not respond to 
  3105.                        BIOS.
  3106. AH = AAH               Device Not Ready:Returned SCSI ASC was:
  3107.                               04H  (LUN Not Ready)
  3108.                               28H  (Unit Attention, Ready)
  3109.                               29H  (Unit Attention, Power On)
  3110.                               2AH  (Unit Attention, Mode Select Change)
  3111. AH = BBH               Unknown Target Sense Error Occurred: A SCSI ASC other 
  3112.                        than those specified above was returned from the 
  3113.                        selected SCSI device.
  3114. AH = CCH               Write Error:   Not Returned
  3115. H = FFH                Sense Operation Failed:BIOS unable to retrieve sense 
  3116.                        information from target.
  3117.  
  3118. 6.3 BIOS DISK COMMANDS
  3119.  
  3120. The commands that can be accepted from the operating system by the BIOS include 
  3121. all those commands required for normal DOS operation, for booting of the DOS 
  3122. operating system, for the booting of other operating systems, and for basic 
  3123. maintenance and verification of normal disk operation. The command set is 
  3124. summarized in the following table and each command is described in more detail 
  3125. in the sections following. 
  3126.  
  3127. AH Register Meaning
  3128.  
  3129. 00 H Reset Disk System
  3130. 01 H Read Status of Last Operation
  3131. 02 H Read Desired Sectors into Memory
  3132. 03 H Write Desired Sectors from Memory
  3133. 04 H Verify Desired Sectors
  3134. 06 H Identify SCSI Devices
  3135. 08 H Read Drive Parameters
  3136. 09 H Initialize Drive Pair Characteristics
  3137. 0C H Seek
  3138. 0D H Alternate Disk Reset
  3139. 10 H Test Drive Ready
  3140. 11 H Recalibrate
  3141. 15 H Read DASD Type
  3142.  
  3143. The Format commands (AH = 05, 06, 07, and 1AH) are not supported by the AHA-
  3144. 1540A/1542A BIOS. The format operation is performed under a special format 
  3145. utility installed in ROM and initiated through the DEBUG program. 
  3146.  
  3147. The Diagnostic Reserved commands (AH = 0A, 0B, 0E, 0F, 12, and 14H) are not 
  3148. supported by the AHA-1540A/1542A BIOS. 
  3149.  
  3150. The Park Heads command  (AH = 19H) is not supported by the AHA-1540A/1542A 
  3151. BIOS. 
  3152.  
  3153. The Reserved for Diskette commands (AH = 16, 17, 18) and the commands from 1BH 
  3154. up to FFH are not supported by the AHA-1540A/1542A BIOS. Any attempt to execute 
  3155. any of these unsupported commands will be ended by the BIOS and an error code 
  3156. of  01H (Invalid Function Request) will be returned in the AH register. 
  3157.  
  3158.  
  3159. 6.3.1 Reset Disk System
  3160.  
  3161. The BIOS is requested to reset the disk subsystem. A SCSI Reset operation is 
  3162. performed on the SCSI bus if the bus is busy at the time the Reset Disk System 
  3163. command is received by the host adapter. No other SCSI or host adapter activity 
  3164. occurs. The BIOS command is then passed on to the standard BIOS so that any 
  3165. internally installed hard disks and floppy disk devices can also be reset. If 
  3166. the BIOS is operating concurrently with an internally installed hard disk, the 
  3167. drive number is decremented by the AHA-1540A/1542A BIOS so that the standard 
  3168. BIOS does not attempt to reset the drive that is not installed. 
  3169.  
  3170. Input  Parameters:      AH = 00H
  3171.                         DL = Drive Number (80H or 81H)
  3172.  
  3173. Output Parameters:      AH = Status of Operation
  3174.                         CF =  Return Code
  3175.  
  3176. 6.3.2 Read Status of Last Operation
  3177.  
  3178. The status of the last operation performed to the specified disk is returned. 
  3179. No SCSI activity occurs. The disk status is reset to zero. 
  3180.  
  3181. Input  Parameters:     AH = 01H
  3182.                        DL = Drive Number (80H or 81H)
  3183.  
  3184. Output Parameters:     AH = Status of Operation
  3185.                        CF =  Return Code
  3186.  
  3187. 6.3.3 Read Desired Sectors Into Memory
  3188.  
  3189. The sectors requested by the parameters are read from the disk to the system memory. The SCSI command is executed as a READ (EXTENDED) command (SCSI Operation Code 28H). If the operation fails and an error is reported through the BIOS  status byte, the operation should be retried one time. If a 11 Error (ECC Corrected Data Error) is returned,  the data returned has been corrected and may be used with confidence. 
  3190.  
  3191. Input  Parameters:    AH = 02H
  3192. DL = Drive Number (80H or 81H)
  3193. DH = Head
  3194. CH = Cylinder
  3195. CL = High Cylinder and Sector
  3196. AL = Number of Sectors to Read
  3197. ES:BX = Address of buffer area
  3198.  
  3199. Output Parameters:  AH = Status of Operation
  3200.                     CF =  Return Code
  3201.  
  3202.  
  3203. 6.3.4 Write Desired Sectors from Memory
  3204.  
  3205. The sectors requested by the parameters are written from the system memory to 
  3206. the indicated disk. The SCSI command is executed as a WRITE (EXTENDED) command 
  3207. (SCSI Operation Code 2AH). If the operation fails and an error is reported 
  3208. through the BIOS  status byte, the operation should be retried one time. 
  3209.  
  3210. Input  Parameters: AH = 03H
  3211.                    DL = Drive Number (80H or 81H)
  3212.                    DH = Head
  3213.                    CH = Cylinder
  3214.                    CL = High Cylinder and Sector
  3215.                    AL = Number of Sectors to Write
  3216.                    ES:BX = Address of buffer area
  3217.  
  3218. Output Parameters: AH = Status of Operation
  3219.                    CF =  Return Code
  3220.  
  3221. 6.3.5  Verify Desired Sectors 
  3222.  
  3223. The sectors defined by the parameters are verified to be correctly written on 
  3224. the SCSI disk. The SCSI command is executed as a VERIFY command (SCSI Operation 
  3225. 2F) with the Byte Check bit set to zero. If the VERIFY command is not supported 
  3226. by the selected disk, the Verify Desired Sectors will perform a SCSI READ 
  3227. command (SCSI Operation Code 28H) and throw away the received data. If the 
  3228. operation fails and an error is reported through the BIOS  status byte, the 
  3229. operation should be retried one time. 
  3230.  
  3231. Input  Parameters: AH = 04H
  3232.                    DL = Drive Number (80H or 81H)
  3233.                    DH = Head
  3234.                    CH = Cylinder
  3235.                    CL = High Cylinder and Sector
  3236.                    AL = Number of Sectors to Verify
  3237.  
  3238. Output Parameters: AH = Status of Operation
  3239.                    CF =  Return Code
  3240.  
  3241. 6.3.6 Identify SCSI Devices
  3242.  
  3243. This is a special AHA-1540A/1542A BIOS call that is used to return the number 
  3244. of the first supported SCSI drive. In the  nonconcurrent case (2 SCSI drives), 
  3245. the returned value will be 80H. If only one SCSI drive is installed, the 
  3246. returned value will be 81H. 
  3247.  
  3248.  
  3249.  in the following table and each command is described in more detail 
  3250. in the sections following. 
  3251.  
  3252. AH Regi
  3253.  
  3254. Input  Parameters:    AH = 06H
  3255.  
  3256. Output Parameters: AH = Status of Operation
  3257.                    AL = First Drive Supported
  3258.                          80H Nonconcurrent operation
  3259.                          81H Concurrent operation
  3260.                    CF =  Return Code
  3261.  
  3262. 6.3.7 Read Drive Parameters
  3263.  
  3264. A SCSI READ CAPACITY command is used to determine the maximum logical block 
  3265. of the selected drive. This information is then used to calculate the proper 
  3266. number of cylinders to be returned to the host system. The number of heads 
  3267. returned will always be 64 and the number of sectors per track will always 
  3268. be 32. The number of drives returned will include both internally installed 
  3269. drives and SCSI drives. 
  3270.  
  3271. Input  Parameters:AH = 08H
  3272.                   DL = Drive Number (80H or 81H)
  3273.  
  3274. Output Parameters:AH = Status of Operation
  3275.                   DL =  Number of BIOS accessible drives attached (1 or 2)
  3276.                   DH =  Maximum value for head number (3FH)
  3277.                   CH =  Maximum value for Cylinder Range (Low Byte)
  3278.                   CL =  Maximum value for Sector, High Cylinder Bits
  3279.                           Bits 7,6      High Order Cylinder Bits
  3280.                           Bits 5-0 Sector Number Maximum Value ( 20H)
  3281.                   CF =  Return Code
  3282.  
  3283. 6.3.8 Initialize Drive Pair Characteristics
  3284.  
  3285. This command performs no operation, since SCSI CCS drives are self 
  3286. configuring. 
  3287.  
  3288. Input  Parameters: AH = 09H
  3289.                    DL = Drive Number (80H or 81H)
  3290.  
  3291. Output Parameters: AH = Status of Operation
  3292.                    CF =  Return Code
  3293.  
  3294. 6.3.9 Seek
  3295.  
  3296. A seek to the logical block address defined by the physical parameters is 
  3297. performed. The seek is performed using the SEEK (EXTENDED) command (SCSI 
  3298. Operation 2BH). The SEEK commands are not mandatory CCS commands and are not 
  3299. required for proper functioning of SCSI devices. If the addressed disk drive 
  3300. reports an error indicating that the SEEK (EXTENDED) command is not 
  3301. supported,  the BIOS command will complete normally anyway. Since the seek 
  3302. operation is performed automatically by a Read or a Write operation, there 
  3303. is no need to generate a separate seek operation to access data. 
  3304.  
  3305.  
  3306. Input  Parameters: AH = 0CH
  3307.                    DL = Drive Number (80H or 81H)
  3308.                    DH = Head
  3309.                    CH = Cylinder
  3310.                    CL = High Cylinder. (Sector bits = 0)
  3311.  
  3312. Output Parameters: AH = Status of Operation
  3313.                    CF =  Return Code
  3314.  
  3315.  
  3316. 6.3.10 Alternate Disk Reset
  3317.  
  3318. The BIOS is requested to reset the disk subsystem. A SCSI Reset operation is performed on the SCSI bus if the bus is busy at the time the Reset
  3319.  
  3320. Input  Parameters: AH = 00H
  3321.                    DL = Drive Number (80H or 81H)
  3322.  
  3323. Output Parameters: AH = Status of Operation
  3324.                    CF =  Return Code
  3325.  
  3326. 6.3.11 Test Drive Ready
  3327.  
  3328. The BIOS command determines that the specified drive is available and ready 
  3329. by executing a TEST UNIT READY command (SCSI Operation Code 00H) to the SCSI 
  3330. device. The command may have to be executed a second time if a Unit 
  3331. Attention condition was detected in the first execution of the TEST UNIT 
  3332. READY. 
  3333.  
  3334. Input  Parameters: AH = 10H
  3335.                    DL = Drive Number (80H or 81H)
  3336.  
  3337. Output Parameters: AH = Status of Operation
  3338.                    CF =  Return Code
  3339.  
  3340. 6.3.12 Recalibrate
  3341.  
  3342. The BIOS command transmits a REZER0 UNIT command (SCSI Operation Code 01H) 
  3343. to the specified drive. Since the REZERO UNIT command is not a mandatory 
  3344. command and is not required for proper functioning of the SCSI device, the 
  3345. BIOS command will complete without indicating an error even if the SCSI 
  3346. device indicates that the command is invalid. 
  3347.  
  3348. Input  Parameters: AH = 11H
  3349.                    DL = Drive Number (80H or 81H)
  3350.  
  3351. Output Parameters: AH = Status of Operation
  3352.                    CF =  Return Code
  3353.  
  3354. 6.3.13 Read DASD Type
  3355.  
  3356. The AHA-1540 BIOS executes this command by performing an INQUIRY  (SCSI 
  3357. Operation Code 12H) and a READ CAPACITY (SCSI Operation Code 25H) to the 
  3358. selected SCSI drive. The INQUIRY command is used to verify that the device 
  3359. is a Direct Access Storage Device. The READ CAPACITY is used to determine 
  3360. the number of logical blocks available. A special return format is used to 
  3361. obtain the required information. 
  3362.  
  3363. Input  Parameters: AH = 15H
  3364.                    DL = Drive Number (80H or 81H)
  3365.  
  3366. Output Parameters:AH = Status of Operation (Special Format)
  3367.                         00H  Drive not present or DL invalid
  3368.                         01H Reserved
  3369.                         02H Reserved
  3370.                         03H Fixed Disk installed
  3371.  
  3372.                   CX,DX  Number of 512 byte blocks available on disk
  3373.                   CF =  Return Code
  3374.  
  3375.  
  3376. 7.1 PC/AT BIOS
  3377.  
  3378. The PC/AT BIOS is provided to allow the user to use the AHA-1540A/1542A in 
  3379. lieu of, or in addition to, a standard PC/AT hard disk controller. This 
  3380. compatibility includes booting from a SCSI device. Hard disk requests are 
  3381. sent to the BIOS via an INT 13 software interrupt. CPU register contents 
  3382. specify the desired I/O function and associated parameters. The BIOS then 
  3383. uses host adapter commands to emulate PC/AT functions. Again, since the 
  3384. mailbox architecture is circumvented, PC/AT BIOS functions run in a single-
  3385. threaded mode. 
  3386.  
  3387. The BIOS consists of three major functional components. These are: 
  3388.  
  3389. 1. Initialization Routine
  3390. 2. System Boot Routine
  3391. 3. Hard Disk I/O Routine
  3392.  
  3393.  
  3394. 7.1.1 Initialization
  3395.  
  3396. The Initialization routine is called at power-up. This routine performs all 
  3397. of the necessary initialization functions and will display the following 
  3398. message if the system successfully recognizes the AHA-1540A/1542A BIOS. 
  3399.  
  3400. ADAPTEC AHA-1540A/1542A HOST ADAPTER BIOS
  3401. COPYRIGHT 1987 ADAPTEC, INC.
  3402. ALL RIGHTS RESERVED.
  3403.  
  3404. If any subsequent initialization of the AHA-1540A/1542A fails, the following 
  3405. message is displayed: 
  3406.  
  3407. HOST ADAPTER NOT FOUND AT PORT 330H.
  3408.  
  3409. otherwise, the AHA-1540A/1542A BIOS chooses a course of action based upon 
  3410. the number and types of hard disks already installed. In each case, the 
  3411. number of hard disks already installed is displayed along with the ID 
  3412. numbers of any SCSI devices that are successfully used by the BIOS. 
  3413.  
  3414. Possible Messages:
  3415.  
  3416. HARD DISK #0 ALREADY INSTALLED.
  3417. HARD DISK #1 ALREADY INSTALLED.
  3418. HOST ADAPTER DIAGNOSTIC FAILURE.
  3419. SCSI DEVICE 0 : 0 NOT FOUND.
  3420. USING SCSI DEVICE 0 : 0 AS HARD DISK #0.
  3421. USING SCSI DEVICE 0 : 0 AS HARD DISK #1.
  3422. USING SCSI DEVICE 0 : 1 AS HARD DISK #1.
  3423. USING SCSI DEVICE 1 : 0 AS HARD DISK #1.
  3424.  
  3425. NOTE: No error message is displayed if a second SCSI drive is not available. 
  3426. If the system reports an initial number of hard drives greater than 2, the 
  3427. following message is displayed: 
  3428.  
  3429. SYSTEM CONFIGURATION ERROR.
  3430.  
  3431. The AHA-1540A/1542A BIOS allows the use of 0, 1, or 2 hard disks on the SCSI 
  3432. bus under DOS without a device driver. 
  3433.  
  3434. If 2 hard disks are attached to an internal hard disk controller, and are 
  3435. already recognized by the system, the BIOS does nothing. A device driver 
  3436. will be needed to access SCSI devices. 
  3437.  
  3438. If 1 hard disk is attached to an internal hard disk controller, and is 
  3439. already recognized by the system, the BIOS attempts to assign the SCSI 
  3440. device (Target : LUN) 0 : 0 as the second drive. (drive D:) If this is 
  3441. unsuccessful, an initialization error is reported to the system. 
  3442.  
  3443. If there are 0 hard disks attached to an internal controller, the BIOS 
  3444. attempts to assign the first SCSI device (Target : LUN) 0 : 0 as the first 
  3445. drive. (drive C:) If this is unsuccessful an initialization error is 
  3446. reported to the system. If successful, the BIOS attempts to assign another 
  3447. SCSI device as the second drive. (drive D:) Device 0 : 1 is tried first, and 
  3448. if that fails, device 1 : 0 is tried. There is no initialization error 
  3449. reported if a second drive is not available. 
  3450.  
  3451. 7.1.2 System Boot
  3452.  
  3453. System boot is invoked by execution of an Interrupt 19. No interception of 
  3454. this interrupt is necessary, as the PC/AT BIOS manages the boot process. 
  3455. When the boot procedure attempts to read the boot track from drive C:, the 
  3456. AHA-154XA BIOS will respond if drive C: is a SCSI Drive. Only SCSI drive 0:0 
  3457. can be assigned as a SCSI C: drive. Mother board BIOS's that use interrupt 
  3458. 13 to perform booting should boot normally from SCSI drives using the AHA-
  3459. 154XA. 
  3460.  
  3461. 7.1.3 Hard Disk I/O
  3462.  
  3463. The BIOS enables up to two SCSI drives to be accessed via interrupt 13 as 
  3464. described in Section 6. 
  3465.  
  3466. 7.2 XENIX/UNIX Drivers
  3467.  
  3468. SCO Xenix and Unix, Interactive Systems Unix, and Microport Unix all support 
  3469. the AHA-1540A/1542A at the time of this publication. Please consult with 
  3470. these Operating System companies for more information on their products. 
  3471.  
  3472.  
  3473. 7.3 DOS Driver
  3474.  
  3475. An optional DOS Driver is available that enables the AHA-1540A/1542A to 
  3476. access additional SCSI devices on the SCSI bus. When operating under DOS, a 
  3477. device driver is needed to access more than two hard disks, tape devices or 
  3478. other types of SCSI peripherals. In addition, DOS applications that use the 
  3479. virtual memory mode of the 80386 processor require this driver. If you are 
  3480. not running DOS programs that operate in the virtual 80386 mode, or if all 
  3481. DOS operations will be confined to two SCSI disks or one internal and one 
  3482. SCSI disk, a device driver is not needed because of the on-board BIOS. The 
  3483. DOS driver is installed by creating a DOS configuration (CONFIG.SYS) file 
  3484. that calls the device driver at boot time. Please refer to your DOS manual 
  3485. for information on creating a CONFIG.SYS file. At initial system loading, 
  3486. the AHA-1540A/1542A device driver will determine the number of hard disks 
  3487. attached to the system. The device driver is normally only installed if one 
  3488. of the following cases is true. 
  3489.  
  3490. 1) There are two internal hard disks and one or more SCSI disks.
  3491. 2) There is one internal hard disk and two or more SCSI disks.
  3492. 3) There are no internal hard disks and more than two SCSI disks.
  3493.  
  3494.  
  3495. The following table shows how hard disks in a system are addressed:
  3496.  
  3497.       configuration                 c:           d:           device driver
  3498. ┌────────────────────────┬────────────────┬───────────────┬──────────────┐
  3499. │two internal hard drives│  1st int. disk │ 2nd int. disk │  SCSI        │
  3500. │                        │                │               │  devices     │
  3501. ├────────────────────────┼────────────────┼───────────────┼──────────────┤
  3502. │one internal hard drive │  int. hard disk│  SCSI 0/0     │ other SCSI   │
  3503. │                        │                │               │  devices     │
  3504. ├────────────────────────┼────────────────┼───────────────┼──────────────┤
  3505. │no internal hard drive  │  SCSI 0/0 disk │  SCSI 0/1     │ other SCSI   │
  3506. │                        │                │   or 1/0      │  devices     │
  3507. └────────────────────────┴────────────────┴───────────────┴──────────────┘
  3508.  
  3509. The SCSI disk drives that are accessed by the device driver are divided into 
  3510. 32 MB logical disks. There can be multiple logical disks on one physical 
  3511. SCSI disk drive. A utility program is also provided that performs the 
  3512. functions of the DOS FDISK and FORMAT utilities. This utility will perform 
  3513. FDISK and FORMAT to SCSI disks that can only be accessed through the device 
  3514. driver. These utility programs partition the disks and create file 
  3515. directories so that DOS files may be copied and accessed from SCSI drives. 
  3516. Please refer to your DOS manual for details of FDISK and FORMAT. 
  3517.  
  3518. SCSI 2 compatible and QIC 104 command set  1/4" tape drives are also be 
  3519. supported by the DOS device driver. The user accesses a SCSI tape drive by 
  3520. building a CCB as described in Section Five. The device driver passes the 
  3521. CCB to the AHA-1540A/1542A and instructs the AHA-1540A/1542A to complete the 
  3522. command. Software products such as Sytron Corporations SYTOS Tape Operating 
  3523. System automatically interface to the Adaptec AHA-1540A/1542A DOS driver. 
  3524.  
  3525. To install the driver into your boot routine, you must create, or edit the 
  3526. DOS configuration file named CONFIG.SYS. You can use any file editor to do 
  3527. this, or you can create it through the "COPY CON: CONFIG.SYS" DOS command. 
  3528. Refer to your  DOS manual for more information on this command. Once 
  3529. installed, the driver operates transparently to the user. 
  3530.  
  3531. 7.3.1 DOS Driver Support of Virtual Mode
  3532.  
  3533. The use of high performance 16-bit Bus Master DMA on the AHA-1540A/1542A 
  3534. SCSI host adapter may result in incompatible operation with application 
  3535. programs that use the 80386 virtual memory mode of operation. 
  3536.  
  3537. In real mode, the host adapter BIOS is passed a physical address. This is 
  3538. necessary since the host adapter controls all SCSI I/O without CPU 
  3539. intervention. This physical address may not be passed to the host adapter 
  3540. when the system is in the V86 mode. Programs that use the V86 mode can only 
  3541. be run on 80386 machines. 
  3542.  
  3543. The AHA-1540A/1542A DOS driver also allows this type of application program 
  3544. to run under DOS. 
  3545.  
  3546. 7.4 AHA-1540A/1542A On-board Utilities
  3547.  
  3548. The AHA-154XA BIOS contains a utility program that allows the user to 
  3549. perform the several important functions. The utility programs are accessed 
  3550. using a self explanatory menu. 
  3551.  
  3552. The utilities are accessed using the DOS Debug function. To access the 
  3553. utilities, boot using a standard DOS system disk or diskette. When the DOS 
  3554. prompt symbol appears on the screen, enter the debug program by typing debug 
  3555. and pressing Enter. The debug program will load and present a new cursor, 
  3556. the - symbol. Enter the following line and press enter to invoke the On-
  3557. board Utility program. 
  3558.  
  3559.           G=dc00:6
  3560.  
  3561. If a BIOS base address other than DC000H is being used on the adapter to be 
  3562. tested, replace the dc00 parameter with the actual BIOS base segment. The 
  3563. segment is the upper 16 bits of the 20 bit BIOS base address. 
  3564.  
  3565. The menu options include the following items which are selected by pressing 
  3566. the index number of the menu function. 
  3567.  
  3568. (1)  A list of all devices installed on the SCSI bus may be requested. This 
  3569. information is retrieved via a RETURN INSTALLED DEVICES host IOCP command, 
  3570. followed by INQUIRY commands to all available targets. 
  3571.  
  3572. (2) A device may be selected for execution of the following two functions. 
  3573. Pressing the '2' key toggles the selection from one installed device to the 
  3574. next. 
  3575.  
  3576. (3) A low level, or primary, format of the selected Target/LUN can be 
  3577. requested. A MODE SELECT is issued first to set the block size at 512 bytes 
  3578. per sector. Then a FORMAT command is issued which will format the drive with 
  3579. factory as well as grown defects.  Only one SCSI drive can be formatted at a 
  3580. time. 
  3581.  
  3582. (4) Integrity of a target can be checked by verifying an entire drive. Any 
  3583. correctable errors found will automatically be handled through the SCSI 
  3584. Reassign Blocks Command. If any uncorrectable errors are found the user will 
  3585. first be asked via a screen prompt if reassignment of the effected block 
  3586. should be performed. 
  3587.  
  3588. (5) The user can leave the AHA-154XA On-board Utility functions and return 
  3589. to normal DOS operation. 
  3590.  
  3591.  
  3592. In addition to the On-Board Utilities, a DMA channel test also resides on 
  3593. the AHA-154XA BIOS. The test verifies that all DOS-available memory can be 
  3594. accessed correctly from the host adapter using first party DMA. The test 
  3595. takes from 2 to 10 minutes to execute, depending on the CPU speed and the 
  3596. amount of memory available. The test is invoked by entering the debug 
  3597. program as above and entering: G=DC00:9 
  3598.  
  3599. The program then is activated and verifies each segment of the memory, 
  3600. indicating with screen messages as each segment is verified. The test runs 
  3601. indefinitely or until an error is detected. In most cases of error, the 
  3602. error information cannot be presented since the host operating system is 
  3603. likely to be compromised. The error symptom is usually a system crash. The 
  3604. test is halted by rebooting. 
  3605.  
  3606.  
  3607. 8.0 SCSI FEATURES
  3608.  
  3609. 8.1 SCSI DESCRIPTION, INITIATOR MODE
  3610.  
  3611. The AHA-1540A/1542A provides a very high performance SCSI interface 
  3612. connection. The host adapter meets the ANSI Standard X3.131-1986, describing 
  3613. the SCSI. The host adapter additionally meets conformance level 2 of the 
  3614. specification by implementing the following SCSI options: 
  3615.  
  3616. Accepts or manages the following messages:
  3617.  
  3618.   Command Complete
  3619.   Disconnect    
  3620.   Message Reject
  3621.   Identify
  3622.   Save Data Pointer
  3623.  
  3624.  Performs arbitration
  3625.  
  3626. The following alternatives are selected for the AHA-1540A/1542A SCSI 
  3627. interface connection from those described by X3.131-1986. 
  3628.  
  3629. Single-ended SCSI driver/receivers are used. 
  3630.  
  3631. The Termination Power is supplied through a removable fuse, allowing the 
  3632. user to select whether or not termination power is provided by the host 
  3633. adapter at installation time. 
  3634.  
  3635. Parity is always generated. Parity checking can be disabled through the 
  3636. jumper selection. 
  3637.  
  3638. The "Soft" Reset option is always performed by the AHA-1540A/1542A. If the 
  3639. user desires the "Hard" Reset, an interrupt servicing program that detects 
  3640. the SCSI Reset Detected interrupt in the Interrupt Flags Port must set the 
  3641. Soft Reset bit in the Control Port. This bit forces the host adapter to 
  3642. clear all SCSI related operations, but does not require execution of the 
  3643. diagnostic functions. If the Soft Reset bit has been set, the host software 
  3644. must re-initialize the AHA-1540A/1542A. 
  3645.  
  3646. Synchronous data transfer is supported. Negotiation for the synchronous 
  3647. transfer initiated by another SCSI device will be accepted by the AHA-
  3648. 1540A/1542A at any time. If the jumper has been set to allow it, the AHA-
  3649. 1540A/1542A will also initiate synchronous data transfer negotiation when it 
  3650. has detected that  such negotiation may be required. 
  3651.  
  3652. Multitasking is fully supported. 
  3653.  
  3654. Modify Data Pointers is supported to allow Zero Latency Read operations. 
  3655. In addition to these SCSI functions, the SCSI Common Command Set at level 4B 
  3656. is also supported. While this document was never made a standard, it 
  3657. describes a widely available set of disk drive functions which are supported 
  3658. by the host adapter. The Host Adapter BIOS commands are all mapped in to 
  3659. SCSI CCS commands to allow the proper support of all the most common SCSI 
  3660. disk drives. The Adapter Command "Return Installed Devices" also uses CCS 
  3661. commands to determine which devices are available. 
  3662.  
  3663. The draft ANSI standard for SCSI-2 has been used as a reference for the 
  3664. implementation of all SCSI functions with the expectation that the host 
  3665. adapter will be fully compatible with the final version of the SCSI-2 
  3666. standard. In particular, the Processor type device command set has been 
  3667. selected from the SCSI-2 manual for Target Mode operation. 
  3668.  
  3669.  
  3670. 8.1.1 Linked SCSI Commands
  3671.  
  3672. The AHA-1540A/1542A supports linking of SCSI commands in initiator mode. 
  3673. When the link bit in the SCSI command control byte is set, the target will 
  3674. present either a 0A or 0B message at command completion. The AHA-1540A/1542A 
  3675. uses the the link pointer in a CCB to fetch another CCB. At the same time, 
  3676. the completed CCB status and address are stored in an MBI. If the target 
  3677. returns a 0B or 00 message, the AHA-1540A/1542A generates an interrupt to 
  3678. inform the host of the full MBI. If the target returns a 0A message, the 
  3679. MBIF interrupt is not posted until all linked commands are completed. The 
  3680. linked CCBs must address the same target and LUN since the target is not re-
  3681. selected. 
  3682.  
  3683. 8.1.2 Zero Latency Read Operation
  3684.  
  3685. The AHA-1540A/1542A implements Zero Latency operation through the use of 
  3686. modify data pointer messages. Zero Latency can eliminate rotational latency, 
  3687. depending on the length of the data transfer, by supporting out of order 
  3688. data transfers. This advanced feature is currently only implemented on the 
  3689. ACB-4525Z SCSI to ESDI controller, and is supported transparently to the 
  3690. user. 
  3691.  
  3692. Since the Adaptec host adapter family is the first to support Zero Latency 
  3693. Read operation, this section is intended to briefly explain the required 
  3694. target support. Please refer to the Adaptec ACB-4525Z SCSI to ESDI 
  3695. controller manual for complete details of Zero Latency Read operation. 
  3696.  
  3697. After seeking to the target track, the ACB-4525Z (ACB-4525Z is assumed since 
  3698. it is the first SCSI controller to implement this feature) will begin 
  3699. reading block IDs. If the first block ID is within range of the data 
  3700. transfer, but not the last block of the the data transfer, the ACB-4525Z 
  3701. will begin reading the subsequent blocks into its buffer. Before 
  3702. transferring data the ACB-4525Z will issue a MODIFY DATA POINTER message to 
  3703. the AHA-1540A/1542A. This supplies a positive argument that is added to the 
  3704. value of the current data pointer. The ACB-4525Z will now send this portion 
  3705. of the data transfer to the host. The ACB-4525Z will resume reading data 
  3706. into its buffer as soon as the first block of the data transfer is detected. 
  3707. Before sending this data to the host, the ACB-4525Z will issue a second 
  3708. MODIFY DATA POINTER message to the AHA-1540A/1542A which supplies a negative 
  3709. argument. This returns the data pointer to its original position. This 
  3710. guarantees that a data transfer of one track or less will never require more 
  3711. than a single revolution since data can now be transferred out of order. 
  3712.  
  3713. 8.1.3 SCSI Messages 
  3714.  
  3715. The AHA-154XA host adapter supports a number of special messages in addition 
  3716. to the messages required by meeting conformance level 2. Those messages are 
  3717. described in detail in the SCSI specification, X3.131-1986, and in this 
  3718. section where they are used. The messages are summarized in this table: 
  3719.  
  3720. FUNCTION                MESSAGE                   CAUSED BY
  3721.  
  3722.  Standard Messages      Command Complete          Normal Sequencing
  3723.  
  3724.  Error Management       Message Reject            Invalid Messages
  3725.                         Bus Device Reset          Special CCB
  3726.                         Abort                     Special MBO
  3727.  
  3728. Disconnect / Reconnect  Identify                  Normal Sequencing
  3729.                         Disconnect                Normal Sequencing
  3730.                         Save Data Pointer         Normal Sequencing
  3731.                         Restore Pointers          Special Sequencing/ZLR
  3732.  
  3733. Synchronous Transfer    Synchronous Data Transfer Initialization Sequencing
  3734.                         Request
  3735.  
  3736. Zero Latency Operation  Modify Data Pointers      ZLR Sequencing
  3737.  
  3738. Linked Commands         Linked Command Complete   Command Linking
  3739.                         Linked Command Complete   Command Linking
  3740.                         With Flag
  3741.  
  3742.  
  3743. 8.2 SCSI DESCRIPTION, TARGET MODE
  3744.  
  3745.  
  3746. 8.2.1 Initiator Conformance Level Requirements
  3747.  
  3748. Initiators that  execute commands against an  AHA-1540A/1542A operating in 
  3749. Target Mode are required to have the following conformance levels, as 
  3750. described in Appendix E of the SCSI  Specification, ANSI  X3.131-1986. 
  3751. Conformance must be present  with respect to each of the following items: 
  3752.  
  3753. The  initiator must use single-ended drivers. 
  3754.  
  3755. Termination power may optionally be provided by the initiator, but must meet 
  3756. the SCSI specification  in both its over-current protection and its  reverse 
  3757. current diode protection.  The terminators may be  installed on the AHA-
  3758. 1540A/1542A board or  installed as in-line terminators at the cable 
  3759. connectors. 
  3760.  
  3761. The implementation of parity is optional, but desirable. The  initiator may 
  3762. support either "hard" reset or "soft" reset. All attached devices must 
  3763. support the same type of reset. 
  3764.  
  3765. The initiator must meet the requirements of conformance level two. In 
  3766. particular, all LUN addressing must be performed by the IDENTIFY message, 
  3767. not by the  LUN field in the CDB. Disconnection and reconnection must be 
  3768. supported. 
  3769.  
  3770. The initiator and target functions have the same SCSI ID. 
  3771.  
  3772.  
  3773. 8.2.2 Support of Synchronous Transfer
  3774.  
  3775. Synchronous transfer is supported by the AHA-1540A/1542A in target mode 
  3776. without any instruction or support from the system processor. If an 
  3777. initiator  invokes a synchronous transfer negotiation, the AHA-1540A/1542A 
  3778. will complete the negotiation of the required transfer offset and period. If 
  3779. the proper jumper has been set, the AHA-1540A/1542A will also attempt to 
  3780. negotiate synchronous transfer during the initial selection period of the 
  3781. first command after an initialization or after a SCSI reset. 
  3782.  
  3783.  
  3784. 8.2.3 SCSI Target Operation in Processor Target Mode
  3785.  
  3786. When the AHA-1540A/1542A has been set to respond in Processor Target Mode, 
  3787. the host adapter appears on the SCSI bus as a normal processor type device 
  3788. as defined by the SCSI specification. From one to eight LUN's may be 
  3789. supported, depending on the LUN mask byte in the Enable Target Mode command.  
  3790. Five SCSI commands are accepted: 
  3791.  
  3792.     TEST UNIT READY    
  3793.     REQUEST SENSE    
  3794.     INQUIRY    
  3795.     SEND
  3796.     RECEIVE
  3797.  
  3798. All other commands are rejected with CHECK CONDITION status. The sense 
  3799. information will indicate a Sense Key of 05H (Illegal Request) with a Sense 
  3800. Code of  20H (Invalid Command Operation Code). 
  3801.  
  3802. The commands that do not perform data transfer to or from the host are 
  3803. handled completely by the AHA-1540A/1542A with no CCB communication with the 
  3804. host system. Those commands are the TEST UNIT READY, REQUEST SENSE, and 
  3805. INQUIRY commands. The SEND and RECEIVE commands must have a CCB from the 
  3806. host with the proper direction bits, the proper initiator address, and the 
  3807. proper LUN number to complete the SCSI operation. The SEND and RECEIVE CCBs 
  3808. may be provided to the host adapter before a command is received on the SCSI 
  3809. or may be requested after the command is received. 
  3810.  
  3811. Each time an initiator activates a command to the AHA-1540A/1542A, an 
  3812. internal sub-channel is activated to manage the command. The sub-channel is 
  3813. dedicated to that particular LUN-Initiator transaction until all operations 
  3814. associated with the command are completed. Such operations include 
  3815. disconnection to obtain a CCB,  pending error conditions, and linked 
  3816. operations. If all sub-channels are busy, a selection to the AHA-1540A/1542A 
  3817. will result in the AHA-1540A/1542A accepting the command and then generating 
  3818. BUSY status immediately. If this occurs, the initiator must re-issue the 
  3819. command later.  
  3820.  
  3821. 8.2.3.1 TEST UNIT READY
  3822.      bit 7     6     5     4     3    2    1    0
  3823.  byte┌──────────────────────────────────────────────┐
  3824.   0  │  ├test unit ready code(00)──────────────────┤│
  3825.      ├──────────────────────────────────────────────┤
  3826.   1  │  ├LUN(unused=0)──┤├──────reserved(00)───────┤│
  3827.      ├──────────────────────────────────────────────┤     
  3828.   2  │  ├────────────────reserved(00)──────────────┤│
  3829.      ├──────────────────────────────────────────────┤     
  3830.   3  │  ├────────────────reserved(00)──────────────┤│
  3831.      ├──────────────────────────────────────────────┤     
  3832.   4  │  ├────────────────reserved(00)──────────────┤│
  3833.      ├──────────────────────────────────────────────┤     
  3834.   5  │  ├──────────reserved(00)─────────├flag┤├link┤│
  3835.      └──────────────────────────────────────────────┘
  3836.  
  3837.  
  3838. The TEST UNIT READY command follows the SCSI specification in all respects. 
  3839. If the AHA-1540A/1542A has been initialized by the Enable Target Mode 
  3840. command to the Processor Target Mode, the command will finish normally with 
  3841. GOOD status and a COMMAND COMPLETE message. The host adapter supports the 
  3842. normal definition of UNIT ATTENTION on the first operation after power on, 
  3843. after a SCSI Reset, or after a BUS DEVICE RESET. 
  3844.  
  3845. If a TEST UNIT READY command is executed against an LUN which was not 
  3846. allowed by the Enable Target Mode command, then CHECK CONDITION status will 
  3847. be presented with sense data of Sense Key 5 (Invalid Request) and an Error 
  3848. Code of 25H (Invalid LUN). 
  3849.  
  3850.  
  3851. 8.2.3.2 REQUEST SENSE
  3852.  
  3853.      bit 7     6     5     4     3    2    1    0
  3854.  byte┌──────────────────────────────────────────────┐
  3855.   0  │  ├request sense operation code (03h)────────┤│
  3856.      ├──────────────────────────────────────────────┤
  3857.   1  │  ├LUN(unused(00)─┤├──────reserved(00)───────┤│
  3858.      ├──────────────────────────────────────────────┤     
  3859.   2  │  ├────────────────reserved(00)──────────────┤│
  3860.      ├──────────────────────────────────────────────┤     
  3861.   3  │  ├────────────────reserved(00)──────────────┤│
  3862.      ├──────────────────────────────────────────────┤     
  3863.   4  │  ├────────────────reserved(00)──────────────┤│
  3864.      ├──────────────────────────────────────────────┤     
  3865.   5  │  ├─────────reserved(00)──────────├flag┤├link┤│
  3866.      └──────────────────────────────────────────────┘
  3867.  
  3868.  
  3869. If the AHA-1540A/1542A has returned CHECK CONDITION status to a previous 
  3870. command, the REQUEST SENSE command will obtain the sense information 
  3871. associated with the error. The sense information will be sent in the 
  3872. extended sense format according to the SCSI standard. The data format is 
  3873. given in the following figure: 
  3874.  
  3875.  
  3876.      bit 7     6     5     4     3    2    1    0
  3877.  byte┌──────────────────────────────────────────────┐
  3878.   0  │  ├error code(07h orf0h)─────────────────────┤│
  3879.      ├──────────────────────────────────────────────┤
  3880.   1  │  ├────────────reserved(00)──────────────────┤│
  3881.      ├──────────────────────────────────────────────┤     
  3882.   2  │  ├───00────┤├ilf┤├──0──┤├──sense key────────┤│
  3883.      ├──────────────────────────────────────────────┤     
  3884.   3- │  ├───────────information bytes──────────────┤│
  3885.      │                                              │
  3886.   6  │  ├───────────(residue)──────────────────────┤│
  3887.      ├──────────────────────────────────────────────┤     
  3888.   7  │  ├─────────additional sense bits────────────┤│
  3889.      ├──────────────────────────────────────────────┤
  3890.   8- │  ├─────────reserved(00000000h))─────────────┤│
  3891.      │                                              │
  3892.  11  │  ├──────────────────────────────────────────┤│
  3893.      ├──────────────────────────────────────────────┤
  3894.  12  │  ├─────────additional sense code────────────┤│
  3895.      ├──────────────────────────────────────────────┤
  3896.  13  │  ├─────additional sense code qualifier(00h)─┤│
  3897.      └──────────────────────────────────────────────┘
  3898.  
  3899.  
  3900. The following errors are detected and presented by the AHA-1540A/1542A while 
  3901. operating in Processor Target Mode: 
  3902.  
  3903. Error                         Sense      Additional Sense
  3904.                                Key               Code
  3905.  
  3906. No Sense Data                   00                00
  3907. Invalid Command Operation Code  00                20
  3908. Invalid LUN                     05                25 
  3909. Invalid Command Parameter       05                26
  3910. Power Up Attention              06                29
  3911. Reset  Attention                06                29
  3912. Interface Parity Error          0B                47
  3913. Initiator Detected Error        0B                48
  3914. Dumb Initiator                  05                2B
  3915.  
  3916.  
  3917. One set of error data may be buffered for each initiator - LU association 
  3918. possible, up to a total of 56 sets of sense data. No Contingent Allegiance 
  3919. or Extended Contingent Allegiance state is established. 
  3920.  
  3921. The Error Code (Byte 0) will be F0h if the residue field is valid and 70h if 
  3922. the residue field has no information. 
  3923.  
  3924. The Incorrect Length Indicator (ILI) will be set if an incorrect data 
  3925. transfer length is executed as described in Section 8.2.4. 
  3926.  
  3927. The residue is set equal to the transfer length requested in the initiator 
  3928. CDB minus the target host's specified data length specified as a four-byte 
  3929. two's complement number. 
  3930.  
  3931. 8.2.3.3 INQUIRY
  3932.  
  3933.      bit 7     6     5     4     3    2    1    0
  3934.  byte┌──────────────────────────────────────────────┐
  3935.   0  │  ├Inquiry Operation code(12h)───────────────┤│
  3936.      ├──────────────────────────────────────────────┤
  3937.   1  │  ├LUN(unused=00)─┤├──reserved(00)───────────┤│
  3938.      ├──────────────────────────────────────────────┤     
  3939.   2  │  ├───────────reserved(00)───────────────────┤│
  3940.      ├──────────────────────────────────────────────┤     
  3941.   3  │  ├───────────reserved(00)───────────────────┤│
  3942.      ├──────────────────────────────────────────────┤
  3943.   4  │  ├───────────Allocation lenth───────────────┤│
  3944.      ├──────────────────────────────────────────────┤     
  3945.   5  │  ├───────────reserved(00)─────────├flag┤├link┤
  3946.      └──────────────────────────────────────────────┘
  3947.  
  3948.  
  3949. The INQUIRY command provides the information necessary to uniquely identify 
  3950. the Adaptec AHA-1540A/1542A as a Processor-type device. The information is 
  3951. returned in the SCSI-2 format. The following information is returned to any 
  3952. selecting initiator from any selected AHA-1540A/1542A Logical Unit: 
  3953.  
  3954.      bit 7     6     5     4     3    2    1    0
  3955.  byte┌──────────────────────────────────────────────┐
  3956.   0  │Peripheral qual'er┤├processor device type(03h┤│
  3957.      ├──────────────────────────────────────────────┤
  3958.   1  │  ├───────────reserved(00)───────────────────┤│
  3959.      ├──────────────────────────────────────────────┤     
  3960.   2  │  ├───────────reserved(00)───┤├ ansi ver(02)─┤│
  3961.      ├──────────────────────────────────────────────┤     
  3962.   3  │  ├────────Response data format(02h)─────────┤│
  3963.      ├──────────────────────────────────────────────┤
  3964.   4  │  ├───────────Additional lenth(1Dh)──────────┤│
  3965.      ├──────────────────────────────────────────────┤     
  3966.   5  │  ├───────────reserved(00)───────────────────┤│
  3967.      ├──────────────────────────────────────────────┤
  3968.   6  │  ├───────────reserved(00)───────────────────┤│
  3969.      ├──────────────────────────────────────────────┤
  3970.   7  │ ├─0─┼──0──┼──0───┼syn=1│lnk=1├─0─┼──0──┼──0─┤│
  3971.      ├──────────────────────────────────────────────┤     
  3972.   8- │  ├───Vendor Identification(ascII)───────────┤│
  3973.      │                                              │
  3974.  15  │  ├─────────Adaptec bbb──────────────────────┤│
  3975.      ├──────────────────────────────────────────────┤
  3976.  16- │  ├────Product identification(asc11)─────────┤│
  3977.      │                                              │
  3978.  31  │  ├────────AHA-1540bbbbbbbb──────────────────┤│
  3979.      ├──────────────────────────────────────────────┤
  3980.  32- │  ├────Product Revision level(asc11)─────────┤│
  3981.      │                                              │
  3982.  35  │  ├──────────────────────────────────────────┤│
  3983.      └──────────────────────────────────────────────┘
  3984.  
  3985. If the INQUIRY command is attempted against a Logical Unit that has not been 
  3986. enabled as a target, byte 0 is returned as 23h, indicating that the LUN is 
  3987. not installed, but would be a Processor Device if it were installed. The 
  3988. remaining bytes are returned normally. 
  3989.  
  3990. If a length shorter than the required 36 bytes is specified by the INQUIRY 
  3991. command, the number of bytes specified by the command is transferred. If a 
  3992. length longer than 36 bytes is specified, the command will only transmit 36 
  3993. bytes. 
  3994.  
  3995.  
  3996. 8.2.3.4 SEND
  3997.  
  3998.  
  3999.      bit 7     6     5     4     3    2    1    0
  4000.  byte┌──────────────────────────────────────────────┐
  4001.   0  │  ├────Send Operation code 0A)───────────────┤│
  4002.      ├──────────────────────────────────────────────┤
  4003.   1  │  ├LUN(unused=00)─┤├──reserved(00)───────────┤│
  4004.      ├──────────────────────────────────────────────┤     
  4005.   2  │  ├──────Transfer lenth(msb)─────────────────┤│
  4006.      ├──────────────────────────────────────────────┤     
  4007.   3  │  ├──────Transfer lenth──────────────────────┤│
  4008.      ├──────────────────────────────────────────────┤
  4009.   4  │  ├──────Transfer lenth(lsb)─────────────────┤│
  4010.      ├──────────────────────────────────────────────┤     
  4011.   5  │  ├───────────reserved(00)─────────├flag┤├link┤
  4012.      └──────────────────────────────────────────────┘
  4013.  
  4014. The SEND command has the format specified by the SCSI standard. 
  4015.  
  4016. The SEND command transfers data from the initiator to the target. The 
  4017. information is placed in the area specified by the appropriate CCB. If an 
  4018. appropriate CCB has not already been provided to the host adapter by the 
  4019. host software, an MBI entry requesting the appropriate CCB is sent to the 
  4020. host from the host adapter. In this case, the target host adapter 
  4021. disconnects from the SCSI until the CCB is made available to the host 
  4022. adapter through the MBO protocol. An appropriate CCB must have the same 
  4023. initiator address, target LUN, and direction as is required to complete the 
  4024. command. 
  4025.  
  4026. The transfer length  in the SEND command specifies the length in bytes of 
  4027. data that is sent during the DATA OUT phase. A transfer length of zero 
  4028. indicates that no data is sent.  Management of incorrect length transfers is 
  4029. described in Section 8.3.2.6. 
  4030.  
  4031. The CDB information is included in the returned CCB so that the receiving 
  4032. host programming can determine whether or not the information transmitted by 
  4033. the SEND command was application data or asynchronous event notification 
  4034. data. 
  4035.  
  4036. 8.2.3.5 RECEIVE
  4037.  
  4038.      bit 7     6     5     4     3    2    1    0
  4039.  byte┌──────────────────────────────────────────────┐
  4040.   0  │  ├────Receive Operation code(08h)───────────┤│
  4041.      ├──────────────────────────────────────────────┤
  4042.   1  │  ├LUN(unused=00)─┤├──reserved(00)───────────┤│
  4043.      ├──────────────────────────────────────────────┤     
  4044.   2  │  ├──────Allocation lenth(msb)───────────────┤│
  4045.      ├──────────────────────────────────────────────┤     
  4046.   3  │  ├──────Allocation lenth────────────────────┤│
  4047.      ├──────────────────────────────────────────────┤
  4048.   4  │  ├──────Allocation lenth(lsb)───────────────┤│
  4049.      ├──────────────────────────────────────────────┤     
  4050.   5  │  ├───────────reserved(00)─────────├flag┤├link┤
  4051.      └──────────────────────────────────────────────┘
  4052.  
  4053. The RECEIVE command has the format specified by the SCSI standard 
  4054.  
  4055. The RECEIVE command transfers data from the target to the initiator. The 
  4056. information is taken from the area specified by the appropriate CCB. If an 
  4057. appropriate CCB has not already been provided to the host adapter host 
  4058. software, an MBI entry requesting the appropriate CCB is sent to the host 
  4059. from the host adapter. In this case, the target host adapter disconnects 
  4060. from the SCSI until the CCB is made available to the host adapter through 
  4061. the MBO protocol. An appropriate CCB must have the same initiator address, 
  4062. target LUN, and direction as is required to complete the command. 
  4063.  
  4064. The transfer length  in the RECEIVE command specifies the length in bytes of 
  4065. data that is sent during the DATA IN phase. A transfer length of zero 
  4066. indicates that no data is sent. Management of incorrect length transfers is 
  4067. described in section 8.3.2.6. 
  4068.  
  4069.  
  4070. 8.2.4 Incorrect Length Management for Target Mode Operation
  4071.  
  4072. The messages transmitted using the SEND and RECEIVE commands are normally 
  4073. expected to have a length that has previously been agreed to by the 
  4074. initiator system software and by the target system software. If the transfer 
  4075. length specified by the command is equal to the transfer length specified by 
  4076. the CCB,  normal operation takes place and no errors are posted. 
  4077.  
  4078. If the transfer length specified by the initiator's command is shorter than 
  4079. the space defined by the target CCB, all data bytes expected and required by 
  4080. the initiator will be transmitted. The target AHA-1540A/1542A will indicate 
  4081. GOOD status on the SCSI at the end of the transfer. The target system's 
  4082. software however must be notified that the entire area of data defined by 
  4083. the CCB was not transmitted. A  Target Status of GOOD will be presented in 
  4084. the returned CCB. At the same time,  the Incorrect Length Indication bit  
  4085. (bit 5 of byte 2) will be set in the CCB Request Sense data area. Bytes  3 
  4086. through 6 of the Request Sense data area will contain the residue in two's 
  4087. complement notation of the length requested in the initiator command minus 
  4088. the length of the data area defined by the CCB. In this case, the residue 
  4089. will be a negative number, since the requested length was less than the area 
  4090. specified by the CCB. The HA status stored in the CCB will be 12h, 
  4091. indicating a Data Over/Under Run. The MBI Status Byte will be set to 04 to 
  4092. indicate that the CCB was completed with an error. If the transfer length 
  4093. specified by the initiator's command is longer than the space defined by the 
  4094. target CCB, only those bytes contained within the CCB's data transfer area 
  4095. will be transmitted. The target AHA-1540A/1542A must indicate with an error 
  4096. condition to the initiator that not all the requested bytes could be 
  4097. transferred. The target AHA-1540A/1542A presents a SCSI status of CHECK 
  4098. CONDITION at the end of the data transfer. The Request Sense information 
  4099. transmitted to the initiator as a result of an immediately following REQUEST 
  4100. SENSE command indicates that an Incorrect Length Indication is present by 
  4101. setting bit 5 of byte 2. Bytes 3 through 6 of the Request Sense information 
  4102. transmitted to the initiator will contain the residue in two's complement 
  4103. notation of the length requested in the initiator command minus the length 
  4104. of the data area defined by the target CCB. In this case, the residue will 
  4105. be a positive number, since the requested length was greater than the 
  4106. available area. The target system's software must also be notified that the 
  4107. transfer length requested by the initiator exceeded the assigned buffer 
  4108. area. A Target Status of CHECK CONDITION will be presented in the returned 
  4109. target CCB. A Host Status of '12'h will be returned indicating a Data 
  4110. Over/Under Run. At the same time, the information that will later be posted 
  4111. to the initiator by the REQUEST SENSE command will be posted to the target 
  4112. system in the CCB Request Sense data area. This includes both the Incorrect 
  4113. Length Indicator and the Residue. The MBI Status Byte will be set to 04 to 
  4114. indicate that the CCB was completed with an error. 
  4115.  
  4116.  
  4117. 9.1 FLOPPY DISK INTERFACE
  4118.  
  4119. The floppy disk controller allows the attachment of any standard IBM 
  4120. compatible floppy disk drive to the AHA-1542A. The floppy disk controller is 
  4121. accessed by the standard IBM compatible BIOS through the standard IBM 
  4122. compatible floppy diskette program interface. The floppy disk controller 
  4123. section of the host adapter is completely independent of the host adapter 
  4124. function. The floppy disk controller section can be disabled by removing 
  4125. jumper J13 as described in section 3.4.2. The base address and interrupt and 
  4126. DMA channels can be modified by jumpers as described in section 3.4. 
  4127.  
  4128. A floppy disk is attached to the host adapter using a 34 pin ribbon cable 
  4129. connector as specified in section 1.4. The pin out of the cable is described 
  4130. here, although that is usually not necessary, since all standard floppy disk 
  4131. drives have the same pin out. Some systems choose to use the same address 
  4132. for all floppy disk drives and to twist the cable, pins 10-16, to switch the 
  4133. address lines at the drive. 
  4134.  
  4135.  
  4136. Signal Name       Pin      Pin      Signal Name        
  4137.  
  4138. Ground             1        2           -LD
  4139. Ground             3        4        Reserved
  4140. Ground             5        6        Reserved
  4141. Ground             7        8        -INDEX
  4142. Ground             9       10        MOTOR ENB DRIVE A
  4143.  
  4144. Ground             11      12        DRIVE SELECT B
  4145. Ground             13      14        DRIVE SELECT A
  4146. Ground             15      16        MOTORO ENB DRIVE B
  4147. Ground             17      18        -DIRECTION
  4148. Ground             19      20        -STEP
  4149.  
  4150. Ground             21      22        -WRITE DATA
  4151. Ground             23      24        -WRITE ENABLE
  4152. Ground             25      26        -TRACK 0
  4153. Ground             27      28        -WRITE PROTECT
  4154. Ground             29      30        -READ DATA
  4155.  
  4156. Ground             31      32        -HEAD SELECT
  4157. Ground             33      34        -DSKCHNG
  4158.  
  4159.  
  4160. 10.0 PROBLEM DETERMINATION
  4161.  
  4162.  
  4163. 10.1 Self Diagnostic Capability
  4164.  
  4165. The AHA-1540A/1542A executes self diagnostics upon power up or after a hard 
  4166. reset. These diagnostics test the CPU operation, perform a sum check on the 
  4167. EPROM, and check the data transfer paths on the board. The host system has 
  4168. the option of exercising more extensive diagnostics involving reads and 
  4169. writes to memory. 
  4170.  
  4171. The red light emitting diode (LED) on the host adapter indicates the result 
  4172. of the self diagnostic process.  When power is first applied to the board, 
  4173. the LED turns on. If the board is operating normally, the light will soon go 
  4174. off and stay off until SCSI or I/O port activity is requested by the host. 
  4175. If the board is not operating correctly,  a flash code number is flashed on 
  4176. the LED to indicate which test failed. The flash code number is indicated by 
  4177. a series of 1 to 6 closely spaced flashes followed by a longer pause. The 
  4178. flash code is repeated continuously until the board is powered off, reset, 
  4179. or repaired.  The SCSI interface should be disconnected if these diagnostic 
  4180. tests are being run for fault isolation purposes. At least one set of 
  4181. terminators must remain installed or the LED will stay on, indicating that 
  4182. the AHA-154XA is receiving an active RST signal. Continuous execution of the 
  4183. diagnostics can also be forced by inserting the diagnostic jumper (pin-pair 
  4184. 2 in jumper J1). The flash code and associated failure modes are indicated 
  4185. in the following table. 
  4186.  
  4187.  
  4188. TABLE OF FLASH CODES
  4189.  
  4190.  
  4191. FLASH CODE    POSSIBLE MEANINGS OF FLASH CODE
  4192.  
  4193. LED           Remains On Host Adapter Control Processor 
  4194.               inoperative/terminators missing or not powered. 
  4195.  
  4196. 1 Flash       Firmware EPROM check sum failed.
  4197.  
  4198. 2 Flashes     RAM test failed.
  4199.  
  4200. 3 Flashes     AIC-6250 SCSI protocol chip verification failed
  4201.  
  4202. 4 Flashes     FIFO read data path test failed.
  4203.  
  4204. 5 Flashes     FIF  write data path test failed.
  4205.  
  4206. 6 Flashes     Channel 2 test failed.
  4207.  
  4208. If any of these failure conditions is identified, the host computer should 
  4209. be powered down, the host adapter removed, and the host adapter inspected 
  4210. for physical damage. Such damage can include EPROM's that are not correctly 
  4211. installed or not firmly seated, broken wires, missing or damaged components,  
  4212. or conductive debris on the board. If no such physical damage is found, the 
  4213. AHA-154XA should be returned for repair. 
  4214.  
  4215. All boards are fully tested, burned in,  cleaned, and inspected before they 
  4216. are shipped. Care should be taken to keep the board in its protective 
  4217. conductive wrapping until it is installed. With these simple precautions, 
  4218. mechanical damage can normally be avoided. 
  4219.  
  4220.  
  4221. 10.2 INDICATORS
  4222.  
  4223. The red light emitting diode (LED) on the AHA-154XA is used to provide the 
  4224. fault isolation information described above. In addition, the LED indicates 
  4225. when the host adapter is performing activities on the host interface and the 
  4226. SCSI interface. The LED is such a useful activity indicator that a connector 
  4227. is made available on the host adapter to allow the cable to an externally 
  4228. visible LED to be attached. (See Section 3.3.9). 
  4229.  
  4230. As an activity indicator the LED is turned on from the time that an Adapter 
  4231. Command is transmitted to the host adapter until the HACC interrupt is 
  4232. generated to indicate that the Adapter Command is complete. In addition, the 
  4233. LED will be turned on whenever SCSI bus activity is occurring. This is 
  4234. roughly the same period of time that the SCSI BSY signal is present on the 
  4235. SCSI bus. If the light stays on when no activity is expected to be present 
  4236. on the bus, it is possible that the bus is hung, the processor has failed, 
  4237. that unexpected activity is occurring, or that the SCSI cables are 
  4238. incorrectly installed. If the SCSI cables are installed reversed, the host 
  4239. adapter is forced in to a solid SCSI reset state which halts normal 
  4240. operation. 
  4241.  
  4242.  
  4243. 10.3 PROBLEMS DETECTED DURING OPERATION
  4244.  
  4245. The information in section 10.3 is not intended for routine users of the 
  4246. AHA-1502A/1542A. It is intended to provide a reference for programmers 
  4247. preparing device drivers, error recovery procedures, and error information 
  4248. presentation programs. 
  4249.  
  4250. Operation of the I/O Port interface is controlled and monitored by host 
  4251. system software. Two bits in the Status Port (Base + 0), described in 
  4252. section 4.2.1, are provided to indicate unusual conditions in the host 
  4253. adapter. 
  4254.  
  4255. Internal Diagnostic Failure (Status Port, bit 6): This bit indicates that 
  4256. the self testing process after either a hard reset or a power on operation 
  4257. was terminated by an error condition. The error indicates that a critical 
  4258. failure was found in the AHA-154XA control circuitry or data paths.   The 
  4259. error should be presented to the host video display to indicate that 
  4260. diagnostic actions are required. The diagnostic action uses the host adapter 
  4261. diagnostic flash codes to determine if the AHA-154XA is failing. The host 
  4262. system should be powered off, then opened so that the LED can be observed. 
  4263. All SCSI cables, both external and internal, should be removed from the host 
  4264. adapter. The system should then be powered on. If the LED flashes once and 
  4265. turns off, the host adapter has passed its diagnostics and should be 
  4266. accessible again. If the LED flashes one of the error flash codes, the AHA-
  4267. 154XA  should be replaced. If the LED remains on and does not turn off, the 
  4268. host adapter is not able to begin operation at all. The host system may be 
  4269. holding the AHA-154XA in the reset state or the host adapter may have 
  4270. failed. To distinguish these two cases, the AHA-154XA should be replaced and 
  4271. the new host adapter operation should be verified. Be sure to power down the 
  4272. host system when removing or replacing the host adapter. If the diagnostics 
  4273. indicate that the AHA-154XA must be replaced, it should be sent to an 
  4274. authorized service facility for repair. 
  4275.  
  4276. Invalid Host Adapter Command (Status Port, bit 0):  This bit is set to 
  4277. indicate that a command or parameter transmitted to the host adapter was 
  4278. invalid.  This is an indication that the host software, usually an operating 
  4279. system, special application program, or device driver, has generated an 
  4280. invalid request. The responsible programming organization should be notified 
  4281. so that the invalid sequence or parameter can be corrected. 
  4282.  
  4283.  
  4284. 10.3.1 HA Status Error Indications and Corrective Actions
  4285.  
  4286. The Host Adapter Status indications, in addition to indicating several 
  4287. normal completion states, indicate three general groups of errors. One set 
  4288. describes software errors in the requests made to the host adapter. Even 
  4289. though most of these errors are caused by software design problems, the AHA-
  4290. 154XA may need to be replaced as an isolation step, since there exists a 
  4291. small chance that hardware failures in the AHA-154XA cause the appearance of 
  4292. a software error. 
  4293.  
  4294. A second set describes errors detected by the host adapter firmware in the 
  4295. host adapter hardware. The most likely failing component in this case is the 
  4296. AHA-154XA, although certain system or cable failures may generate the 
  4297. appearance of a host adapter hardware error. 
  4298.  
  4299. A third set describes the appearance of unexpected or incorrect sequences 
  4300. executed by the attached SCSI devices. In this case, the cables are the most 
  4301. likely failure point, with the peripheral device second and the AHA-154XA 
  4302. third. The host adapter status code should be returned to the host video 
  4303. display to indicate to the operator what errors have occurred and under what 
  4304. conditions the errors occurred. The following section describes those Host 
  4305. Adapter Status indications that indicate an error. 
  4306.  
  4307. NUMBER TYPE ERROR   DESCRIPTION AND CORRECTIVE ACTION
  4308.  
  4309. 11     SCSI NO      Selection Time Out: The SCSI attempted to select a 
  4310.                     device that was not installed or that did not respond to 
  4311.                     selection due to a power, parity or addressing failure. 
  4312.                     Verify correct address values set to SCSI devices. 
  4313.                     Verify that SCSI cable routing includes the required 
  4314.                     devices. Verify  SCSI cable integrity by replacement of 
  4315.                     cables. Verify that SCSI Selection Time Out value has 
  4316.                     been correctly established by Adapter Command. 
  4317.  
  4318. 12     HOST NO      Data Over Run / Under Run: Data length or direction 
  4319.                     specified by CCB did not agree with the data length 
  4320.                     actually provided by the attached peripheral device. 
  4321.                     Often a normal error or accompanied by a check condition 
  4322.                     indicating transfer truncation. Verify program requested 
  4323.                     correct length or direction. Verify peripheral provided 
  4324.                     expected data length, number of blocks, or block length. 
  4325.  
  4326. NUMBER TYPE ERROR   DESCRIPTION AND CORRECTIVE ACTION
  4327.  
  4328.  
  4329. 13     SCSI  YES    Unexpected Bus Free: The target dropped BSY without 
  4330.                     executing the proper messages first. This normally 
  4331.                     indicates that the BSY and/or other portions of the SCSI 
  4332.                     bus failed or that the target encountered such an 
  4333.                     invalid sequence that no recovery was possible. Some 
  4334.                     targets may have sense information available to qualify 
  4335.                     the error condition. Verify SCSI cable integrity. Verify 
  4336.                     SCSI cables are all properly connected. Replace SCSI 
  4337.                     cables. Replace peripheral. Replace AHA-154XA. 
  4338.  
  4339. 14     SCSI  YES    Target bus phase sequence failure:    The initiator detected 
  4340.                     an invalid phase or an invalid phase sequence. If this 
  4341.                     occurs, it is likely that the host adapter forces a SCSI 
  4342.                     reset on the bus as the first phase of the recovery 
  4343.                     process. Verify SCSI cable integrity. Verify SCSI cables 
  4344.                     are all properly connected. Replace SCSI cables. Replace 
  4345.                     peripheral. Replace AHA-154XA 
  4346.  
  4347. 15     HOST  YES    MBO Command Byte invalid:    This indicates a software 
  4348.                     failure or bug in the host's development of the MBO 
  4349.                     entry. Generally, this indication will only occur during 
  4350.                     initial debug processes of new operating systems. 
  4351.                     Replace the AHA-154XA. Replace the host computer system. 
  4352.                     Contact the software developer for design support. 
  4353.  
  4354. 16     HOST  YES    Invalid CCB Operation Code:    This indicates a software 
  4355.                     failure or bug in the host's development of the CCB. 
  4356.                     Generally, this indication will only occur during 
  4357.                     initial debug processes of new operating systems. 
  4358.                     Replace the AHA-154XA. Replace the host computer system. 
  4359.                     Contact the software developer for design support. 
  4360.  
  4361. 17     HOST  YES    Linked CCB does not have same LUN:  This indicates that 
  4362.                     the host software generated an invalid combination of 
  4363.                     link commands. Generally, this indication will only 
  4364.                     occur during initial debug processes of new operating 
  4365.                     systems. Replace the AHA-154XA. Replace the host 
  4366.                     computer system. Contact the software developer for 
  4367.                     design support. 
  4368.  
  4369. NUMBER TYPE ERROR    DESCRIPTION AND CORRECTIVE ACTION
  4370.  
  4371. 18     HOST  YES    Invalid Target Direction Parameters received from Host:  
  4372.                     This indicates that the host software generated an 
  4373.                     invalid Target Direction Parameter. Generally,  this 
  4374.                     indication will only occur during initial debug 
  4375.                     processes of new operating systems. Replace the AHA-
  4376.                     154XA. Replace the host computer system. Contact the 
  4377.                     software developer for design support. 
  4378.  
  4379. 19     HOST YES     Duplicate CCB Received in Target Mode: This indicates 
  4380.                     that the host system was not keeping correct management 
  4381.                     information for target mode operation and incorrectly 
  4382.                     generated a second CCB identical to one already active. 
  4383.                     Generally,  this indication will only occur during 
  4384.                     initial debug processes of new operating systems. 
  4385.                     Replace the AHA-154XA. Replace the host computer system. 
  4386.                     Contact the software developer for design support. 
  4387.  
  4388. 1A     HOST YES     Invalid CCB Parameter or Segment List: A segment list 
  4389.                     was presented to the host adapter with a zero length 
  4390.                     segment or invalid segment boundaries. An invalid CCB 
  4391.                     parameter was presented to the host adapter. 
  4392.                     Generally,this indication will only occur during initial 
  4393.                     debug processes of new operating systems. Replace the 
  4394.                     AHA-154XA. Replace the host computer system. Contact the 
  4395.                     software developer for design support. 
  4396.  
  4397.  
  4398. 10.3.2 SCSI Error Indications and Corrective Actions
  4399.  
  4400. Error conditions detected by SCSI peripherals usually cause a CHECK 
  4401. CONDITION Status byte to be presented. When this is presented, the host 
  4402. adapter automatically retrieves the sense information from the SCSI 
  4403. peripheral by executing a REQUEST SENSE command according to the SCSI 
  4404. standard. The information returned is mapped for single-threaded BIOS 
  4405. operation into the categories of error conditions described in section  
  4406. 5.2.2. For multitasking (mailbox) operation, the information returned is 
  4407. made available in the area allocated for Sense Data. In either case, an 
  4408. intelligent attempt is made by most operating systems to retry the operation 
  4409. at least one time. Such retry operations may require the management of 
  4410. queued operations that have already started execution. This attempt to retry 
  4411. the operation is rarely successful, since SCSI peripheral devices have very 
  4412. extensive automatic retry and correction mechanisms designed to be executed 
  4413. before the error information is returned in the first place. 
  4414.  
  4415. Since it is rare that such an operation is successful, the host software and 
  4416. operating systems should make every attempt to make available key 
  4417. information about the error which can be analyzed by the system operator or 
  4418. customer engineer. In small systems, it may be sufficient to present the 
  4419. important Sense Data together with the command that created the error. Some 
  4420. simpler systems may perform a preliminary analysis of the error information 
  4421. and generate a code or descriptive text that describes the error and 
  4422. indicates the corrective action. In very complex systems, a logging process 
  4423. may take place, allowing a customer engineer to analyze the data at some 
  4424. future time. In all systems, such information is very important for host 
  4425. program verification and for system integrity verification, even if the 
  4426. designers choose not to make the information available to any system users 
  4427. other than the design and maintenance engineers. 
  4428.  
  4429. The SCSI Sense Data is generally self descriptive. The errors can be mapped 
  4430. in to four major categories, each category with its own diagnostic 
  4431. procedure. 
  4432.  
  4433. The first category includes those errors caused by incorrect command or 
  4434. parameter bytes or by incorrect sequences of commands. These errors 
  4435. typically are presented only during the early development stages of an 
  4436. operating system or device driver, since a properly operating program will 
  4437. not generate invalid commands. 
  4438.  
  4439. The second category includes those sense codes associated with peripheral 
  4440. status presentation. Such  sense codes are not truly errors, in that they 
  4441. inform the host program of an unusual but not unexpected condition. Such 
  4442. sense codes include indications that a device is not ready, that the device 
  4443. has just become ready, that a device has reached the end of its media (End 
  4444. of Tape or Blank Check),  or that the expected data length and actual data 
  4445. length differed. These sense codes are normally used by the device driver to 
  4446. execute the correct operation in response to the condition. Such sense codes 
  4447. are not normally presented to the system user except as text that requests 
  4448. some action. As one example, an End Of Tape condition may require the system 
  4449. user to replace the tape cartridge. 
  4450.  
  4451. The third category of errors points to a particular hardware failure in the 
  4452. peripheral device or its supporting electronics. Such error conditions 
  4453. usually require the adjustment, repair, or replacement of the peripheral 
  4454. device or some of its components. In some cases, the error condition may 
  4455. also indicate possible cable or host adapter failures. These errors must be 
  4456. exposed to the system user so that the proper actions can be taken. 
  4457.  
  4458. The fourth category  of errors points to a media failure in the peripheral 
  4459. device. Such errors include bits that cannot be recovered from magnetic 
  4460. media and imperfections in the surface of optical media. Most such errors 
  4461. are recovered using the extensive retry and correction algorithms programmed 
  4462. into the peripheral device. In some peripheral device technologies, the 
  4463. errors may be caused by noise conditions or by marginal electronic failures 
  4464. in the read or write path. Those rare errors that cannot be recovered 
  4465. usually indicate that some data important to the operating system or 
  4466. application has been lost. The system must make this error information 
  4467. available to the system user so that the system user can replace the media 
  4468. or recover the data from a back up copy as required. In addition, logging of 
  4469. errors that were successfully recovered by the peripheral device is often 
  4470. useful as an indicator of the overall reliability of the device or of the 
  4471. requirement for periodic maintenance. 
  4472.  
  4473.  
  4474. 10.4 PROBLEMS DETECTED DURING INSTALLATION
  4475.  
  4476. This section may be useful to correct problems related to installation. The 
  4477. information in this section is included in the Host Adapter Installation 
  4478. Guide. 
  4479.  
  4480. If the system will not boot from the flexible diskette drive after initial 
  4481. hardware installation the following items should be checked: 
  4482.  
  4483.     AHA-1540A/1542A internal diagnostics: The LED on the AHA-1540A/1542A should 
  4484. come on briefly at  system power up. If the LED begins to blink at regular 
  4485. intervals then the host adapter has detected an internal failure and should 
  4486. be returned for repair or replacement to the place of purchase. A message 
  4487. may also be posted to the screen. 
  4488.  
  4489.     If the AHA-1540A/1542A LED and the SCSI drive LED are always on, the SCSI 
  4490. cable's pin 1 orientation has probably been reversed between the host 
  4491. adapter and the drive. See section 3.2. 
  4492.  
  4493.     Is the AHA-1540A/1542A BIOS message displayed on the screen? If not, the 
  4494. AHA-1540A/1542A BIOS is not being recognized by the system. 
  4495.  
  4496. a) Check for BIOS address conflicts between the AHA-1540A/1542A and other 
  4497.    option boards. 
  4498. b) Try a different BIOS address. See section 3.3.
  4499. c) Change the BIOS wait state jumper. See section 3.3.
  4500.  
  4501.     If the HOST ADAPTER NOT FOUND AT PORT 330H message is displayed check the 
  4502. AT port address jumper setting. Also verify that the SCSI cable is correctly 
  4503. installed. A forced SCSI reset caused by an inverted or displaced internal 
  4504. SCSI cable may cause the problem. See Section 3.3. 
  4505.  
  4506. Problems Booting the System from a SCSI drive: 
  4507.  
  4508.     Make sure that both standard hard disks are mapped out of the system by 
  4509. using the AT SETUP program. 
  4510.  
  4511.     Make sure that the SCSI boot drive address is set to SCSI ID 0:0. Check the 
  4512. drive installation manual for information about setting the SCSI ID for that 
  4513. device. The Return Installed Devices utility in the Onboard Utilities can 
  4514. also be used to determine the SCSI addresses of peripherals on the SCSI bus. 
  4515.  
  4516.     Make sure that SCSI parity is consistently enabled or disabled on all 
  4517. devices on the SCSI bus. 
  4518.  
  4519.     Verify that the host adapter and the SCSI devices are properly configured 
  4520. and installed by referencing Section 3. 
  4521.  
  4522.     Power should be cycled off and on after changing any values on a HA, Setup 
  4523. program, or SCSI device to be sure that a DOS format operation has been 
  4524. successfully completed. 
  4525.  
  4526.     Make sure that the SCSI bus is properly terminated. 
  4527.  
  4528.     Make sure that the intended boot disk has an active DOS partition and a DOS 
  4529. format. See section 3.0 and the DOS manual for more information. 
  4530.  
  4531. Problems using a SCSI drive as drive D: with a standard hard disk as drive C:
  4532.  
  4533.     Make sure that the second hard disk is mapped out of the system with the AT 
  4534. SETUP program. 
  4535.  
  4536.     Make sure that the SCSI drive to be used as drive D:  is set to SCSI ID 
  4537. 0:0. Check the drive manual for information on setting the SCSI ID for that 
  4538. device. The Return Installed Devices utility in the Onboard Utilities can 
  4539. also be used to determine the SCSI addresses of peripherals on the SCSI bus. 
  4540.  
  4541.     Make sure that SCSI parity is consistently enabled or disabled on all 
  4542. devices on the SCSI bus. 
  4543.  
  4544.     Verify that the host adapter and the SCSI devices are properly configured 
  4545. and installed by referencing Section 3. 
  4546.  
  4547.     Power should be cycled off and on after changing any values on an HA, Setup 
  4548. program or SCSI device to be sure that the new initial values are loaded. 
  4549.  
  4550.     Make sure that the SCSI bus is properly terminated. See Section 3. 
  4551.  
  4552.     Make sure that the disk has a  DOS partition and a DOS format. See section 
  4553.  
  4554. 5.0 and the system DOS manual for more information. 
  4555.  
  4556. Problems using a SCSI drive as drive D: with another SCSI drive as drive C:
  4557.  
  4558.     Make sure that both standard hard disks are mapped out of the system with 
  4559. the AT SETUP program. 
  4560.  
  4561.     Make sure that the SCSI drive to be used as drive D:  is set to SCSI ID 0:1 
  4562. or 1:0. Check the drive manual for information on setting the SCSI ID for 
  4563. that device. The Return Installed Devices utility in the Onboard Utilities 
  4564. can also be used to determine the SCSI addresses of peripherals on the SCSI 
  4565. bus. 
  4566.  
  4567.     Power should be cycled off and on after changing any values on an HA, Setup 
  4568. program or SCSI device to be sure that the new initial values are loaded. 
  4569.  
  4570.     Make sure that SCSI parity is consistently enabled or disabled on all 
  4571. devices on the SCSI bus. 
  4572.  
  4573.     Verify that the host adapter and the SCSI devices are properly configured 
  4574. and installed by referencing section 3. 
  4575.  
  4576.     Make sure that the SCSI bus is properly terminated. See section 3. 
  4577.  
  4578.     Make sure that the disk has a  DOS partition and a DOS format. See section 
  4579. 3.0 and the DOS manual for more information. 
  4580.  
  4581. System works erratically. Hangs or the host adapter can't always find the 
  4582. drives. 
  4583.  
  4584.     Check SCSI parity for consistency. 
  4585.  
  4586.     Check Termination.
  4587.  
  4588.     Check cable length and integrity.
  4589.  
  4590.     If host adapter and drive light remain on during a hang condition, make sure 
  4591. that the SCSI  drive conforms to the Common Command Set revision 4B. (CCS 
  4592. 4B) 
  4593.  
  4594.     If only the host adapter LED remains on during a hang, it is probably a host 
  4595. adapter, system interface problem. The system may not be capable of First 
  4596. Party DMA transfers. Check with the System manufacturer for information. 
  4597.  
  4598. Adapter Command-A command transmitted to the host adapter using the 
  4599. Command/Data Out Port and the Data In Port. The commands are sequenced using 
  4600. the Control Port, the Status Port, and the Interrupt Flag Port. Abbreviated 
  4601. as IOCP command. 
  4602.  
  4603. AEN-See Asynchronous Event Notification
  4604.  
  4605. AHA-AHA-1540A-Adaptec Host Adapter for connecting SCSI devices to the PC/AT 
  4606. backplane bus. The AHA-154XA is an enhancement of the AHA-1540 (see Appendix 
  4607. C) 
  4608.  
  4609. AHA-1540A-The enhanced high performance Adaptec Host Adapter for connecting 
  4610. SCSI devices to the PC/AT backplane bus. 
  4611.  
  4612. AHA-1542A-The enhanced high performance Adaptec Host Adapter for connecting 
  4613. SCSI devices and standard IBM compatible floppy disk devices to the PC/AT 
  4614. backplane bus. 
  4615.  
  4616. AHA-154XA-Either the AHA-1540A or the AHA-1542A or both. 
  4617.  
  4618. AHA-1540A/1542A-Either the AHA-1540A or the AHA-1542A or both. 
  4619.  
  4620. Asynchronous Event Notification-A process by which a target can send 
  4621. unsolicited sense information to an initiator using the SEND command in 
  4622. order to inform the initiator about the occurrence of an important unusual 
  4623. occurrence. 
  4624.  
  4625. Asynchronous Data Transfer-Data transfer performed by the SCSI interface 
  4626. involving the interlocking of a signal to the initiator (REQ) and a signal 
  4627. to the target (ACK) such that each step of the data transfer protocol must 
  4628. occur before the next step can begin. Characterized by a low data rate and 
  4629. independence of external timing constraints, including cable length and 
  4630. circuit response times. 
  4631.  
  4632. AT Bus-The Industry Standard Architecture bus. 
  4633.  
  4634. Bus Device Reset-A SCSI message that clears all activity in the target to 
  4635. which it is addressed. 
  4636.  
  4637. Byte-An 8 bit unit of data. An octet. A byte is normally the smallest 
  4638. addressable unit of a memory and the unit of transfer on the SCSI. 
  4639.  
  4640. CCB-See Command Control Block 
  4641.  
  4642. CCS-See Common Command Set 
  4643.  
  4644. CDB-See Command Descriptor Block 
  4645.  
  4646. Command Control Block-A software object prepared by the host microcomputer 
  4647. software for the host adapter to provide it all the control information it 
  4648. needs to execute a SCSI command.  Abbreviated CCB. 
  4649.  
  4650. Command Descriptor Block-A block of information passed across the SCSI bus to 
  4651. provide the command, parameter, and address information necessary for the 
  4652. target to execute the desired functions. Prepared by the host software and 
  4653. placed in the CCB to be passed to the target by the host adapter. 
  4654. Abbreviated CDB. 
  4655.  
  4656. Common Command Set-A defacto standard SCSI command set for communication with 
  4657. hard disk drives. The Common Command Set (CCS) is the basis for the SCSI-2 
  4658. command set for all types of peripheral devices. 
  4659.  
  4660. Control Microprocessor    An integrated circuit computer used to execute the 
  4661. software that controls the host adapter's operation. 
  4662.  
  4663. Device Driver-A program that is linked with or attached to an operating 
  4664. system to map the software interface of the operating system to the 
  4665. requirements of attached peripheral devices and host adapters. 
  4666.  
  4667. DMA-See Direct Memory Access
  4668.  
  4669. Direct Memory Access-A mechanism that allows hardware control of the 
  4670. transfer of streams of data to or from the main memory of a computing 
  4671. system. The mechanism may require set up the host software. After 
  4672. initialization, it automatically sequences the required data transfer and 
  4673. provides the necessary address information. 
  4674.  
  4675. EPROM-Erasable Programmable Read Only Memory.  An integrated circuit used to 
  4676. store the host adapter firmware and the host adapter BIOS. 
  4677.  
  4678. FIFO-First In / First Out.- 
  4679.  
  4680. A queueing order in which items are removed from the queue for execution in 
  4681. the same order in which they are placed in the queue. 
  4682. An integrated circuit that buffers data in such a manner that the each byte 
  4683. placed in the buffer is removed from the buffer in the same order. 
  4684.  
  4685. Firmware-The software that controls and manages the host adapter. It is 
  4686. 'firm' as opposed to 'soft' because it  is designed in to the host adapter 
  4687. and cannot be modified by the user. 
  4688.  
  4689. IBM PC/AT Compatible-Any computer system that emulates exactly the IBM PC/AT 
  4690. and that uses an ISA backplane bus. 
  4691.  
  4692. ISA-The Industry Standard Architecture
  4693.  
  4694.  
  4695. Industry Standard Architecture-The IBM PC/AT functions have been duplicated 
  4696. by a number of manufacturers. All the IBM PC/AT¬ compatible machines use a 
  4697. backplane bus that very closely emulates the function of the backplane bus 
  4698. of the PC/AT. Because of the broad usage of this bus structure, it has 
  4699. become known as the Industry Standard Architecture bus, even though there is 
  4700. no presently accepted standard for the bus. 
  4701.  
  4702. initiator-A SCSI device that requests an operation to be performed by another 
  4703. SCSI device (the target). The initiator provides all the command information 
  4704. and parameters required to perform the operation, but the details of the 
  4705. operation are actually sequenced by the target. 
  4706.  
  4707. host-A microcomputer in which a host adapter is installed. The host uses 
  4708. software to request the services of the host adapter in transferring 
  4709. information to and from peripheral devices attached to the SCSI bus 
  4710. connector of the host adapter. 
  4711.  
  4712. host adapter-A hardware printed circuit board that installs in a standard 
  4713. microcomputer backplane and provides a SCSI bus connection so that SCSI 
  4714. devices can be connected to the microcomputer. A host adapter is 
  4715. "intelligent" if it has a simple high-level software interface to the 
  4716. microcomputer. A host adapter is "dumb" if the microcomputer must directly 
  4717. manage the SCSI protocol using the microcomputer processor. 
  4718.  
  4719. Logical Unit-A physical or virtual device addressed through a target. 
  4720.  
  4721. Logical Unit Number-An encoded three-bit identifier for a logical unit. 
  4722.  
  4723. LU-See Logical Unit 
  4724.  
  4725. LUN-See Logical Unit Number 
  4726.  
  4727. Mailbox In-An area in main memory assigned by the host microcomputer software 
  4728. for communication with the host adapter. The host adapter places status and 
  4729. pointer information in entries in the Mailbox In (MBI) to indicate to the 
  4730. host microcomputer what operations have been completed or what information 
  4731. must be obtained from the host microcomputer. 
  4732.  
  4733. Mailbox Out-An area in main memory assigned by the host microcomputer 
  4734. software for communication with the host adapter. The microcomputer software 
  4735. places commands and pointer information in entries in the Mailbox Out (MBO) 
  4736. to indicate what operations should be started by the host adapter. 
  4737.  
  4738. MBI-See Mailbox In. 
  4739.  
  4740. MBO-See Mailbox Out. 
  4741.  
  4742. Multi-tasking Operation-The execution of commands in such a way that more 
  4743. than one command is in progress at the same time, allowing the system to 
  4744. take advantage of overlapping activities by using resources that are 
  4745. temporarily not required for other operations. More than one program or more 
  4746. than one portion of a program may be operating in parallel. 
  4747.  
  4748. PC/AT-A family of small computers sold by IBM, also called the Personal 
  4749. Computer /AT family of computers. The name is trademarked by IBM. 
  4750.  
  4751. RAM-Random Access Memory. Memory of which any byte can be accessed directly 
  4752. in a single memory cycle. Information can be read from and written to the 
  4753. memory. 
  4754.  
  4755. SCSI-Small Computer System Interface. 
  4756.  
  4757. SCSI ASC-SCSI Additional Sense Code. Byte 12 of the extended sense 
  4758. information. Provides a standardized description of the condition described 
  4759. by the sense information. 
  4760.  
  4761. SCSI Device-A device attached to a Small Computer System Interface bus 
  4762. cable. The device may be an initiator, a target, or capable of both types of 
  4763. operation. The device may be a peripheral device, a host device, or a device 
  4764. mixing both roles. 
  4765.  
  4766. Single Threaded Operation-Operation of the computing system such that only 
  4767. one program can be operating or active at a time. The computing system must 
  4768. wait until all resources are available before starting an operation and 
  4769. cannot start another operation until the first one is completed. No 
  4770. overlapping of latencies or program operation occurs. 
  4771.  
  4772. Synchronous Data Transfer-A method of data transfer on the SCSI bus 
  4773. involving clocking data on to the bus with a fixed-length fixed-frequency 
  4774. strobe pulses. The acknowledgements may be delayed several clock periods 
  4775. from the data requests. Synchronous Data Transfer can be used only for data 
  4776. transmission on the SCSI bus. It is prohibited for command, message, and 
  4777. status transmission. 
  4778.  
  4779. Synchronous Data Transfer Negotiation-The message exchange between the 
  4780. initiator and the target  that allows the negotiation of the data transfer 
  4781. frequency and delay between requests and acknowledgements required for 
  4782. synchronous data transfer. Once negotiated, synchronous data transfer 
  4783. parameters remain unchanged until certain reinitialization activities occur. 
  4784.  
  4785. Target-A SCSI device that performs an operation requested by an initiator. 
  4786. The target may be  a peripheral device performing a service for an 
  4787. initiator. The target may also be a host adapter performing a Processor type 
  4788. device service for an initiator. 
  4789.  
  4790. Word-A two byte (16 bit) unit of data. 
  4791.  
  4792. AHA-1540A/1542A MEMORY CYCLE TIMING
  4793.  
  4794. to see this diagram send for manual.  
  4795.  
  4796.  
  4797. STANDARD   tRR   TIMING
  4798. SPEEDS     tWW
  4799.     
  4800. 5.0 MB     250     A      tARS Address Setup to MEMR Leading Edge
  4801. 5.7 MB     200     A      tARH Address Hold from MEMR Trailing Edge
  4802. 6.7 MB     200     A      tBRS SBHE Setup to MEMR Leading Edge
  4803. 8.0 MB     150     A      tDRS Data Setup to Trailing Edge of MEMR
  4804. 10.0 MB    100     B      tDRH Data Hold from MEMR Trailing Edge
  4805.                           tRW    Read Pulsewidth
  4806.  
  4807. SPEED   TIMING A    TIMING B  tAWS Address Setup to MEMW Leading Edge
  4808.                               tAWH Address Hold from MEMW Trailing Edge
  4809. tARS    73           23       tBWS SBHE Setup to MEMW Leading Edge
  4810. tARH    55           55       tDWS Data Setup to MEMW Leading Edge
  4811. tBRS    73           23       tDWH Data Hold from MEMW Trailing Edge
  4812.                               tWW  Write Pulsewidth
  4813. tDRS    32           32
  4814. tDRH    26           26       Note: I/O Channel Ready may slow the actual 
  4815. tAWS    73           23             transfer rate
  4816.  
  4817. tAWH    55           55
  4818. tBWS    73           23
  4819. tDWS    13           13
  4820. tDWH    60           60
  4821.  
  4822. Appendix B CONNECTOR PINOUT
  4823.  
  4824. Internal Connector Pin Assignments
  4825.  
  4826. Signal Name   Pin   Pin  Signal Name        
  4827.  
  4828. Ground         1     2    -DB(0)
  4829. Ground         3     4    -DB(1)
  4830. Ground         5     6    -DB(2)
  4831. Ground         7     8    -DB(3)
  4832. Ground         9    10    -DB(4)
  4833.  
  4834. Ground        11    12    -DB(5)
  4835. Ground        13    14    -DB(6)
  4836. Ground        15    16    -DB(7)
  4837. Ground        17    18    -DB(P)
  4838. Ground        19    20    Ground
  4839.  
  4840. Ground        21    22    Ground
  4841. Ground        23    24    Ground
  4842. Open          25    26    Term Power (Fused)
  4843. Ground        27    28    Ground
  4844. Ground        29    30    Ground
  4845.  
  4846. Ground        31    32    -ATN
  4847. Ground        33    34    Ground
  4848. Ground        35    36    -BSY
  4849. Ground        37    38    -ACK
  4850. Ground        39    40    -RST
  4851.  
  4852. Ground        41    42    -MSG
  4853. Ground        43    44    -SEL
  4854. Ground        45    46    -C/D
  4855. Ground        47    48    -REQ
  4856. Ground        49    50    -I/O
  4857.  
  4858. External Connector Pin Assignments
  4859.  
  4860. Signal Name   Pin   Pin   Signal Name
  4861. Ground         1     26    -DB(0)
  4862. Ground         2     27    -DB(1)
  4863. Ground         3     28    -DB(2)
  4864. Ground         4     29    -DB(3)
  4865. Ground         5     30    -DB(4)
  4866.  
  4867. Ground         6     31    -DB(5)
  4868. Ground         7     32    -DB(6)
  4869. Ground         8     33    -DB(7)
  4870. Ground         9     34    -DB(P)
  4871. Ground        10     35    Ground
  4872.  
  4873. Ground        11     36    Ground
  4874. Ground        12     37    Ground
  4875. Open          13     38    Term Power (Fused)
  4876. Ground        14     39    Ground
  4877. Ground        15     40    Ground
  4878.  
  4879. Ground        16     41    -ATN
  4880. Ground        17     42    Ground
  4881. Ground        18     43    -BSY
  4882. Ground        19     44    -ACK
  4883. Ground        20     45    -RST
  4884.  
  4885. Ground        21     46    -MSG
  4886. Ground        22     47    -SEL
  4887. Ground        23     48    -C/D
  4888. Ground        24     49    -REQ
  4889. Ground        25     50    -I/O
  4890.  
  4891. Appendix C    AHA-1540/1640 FAMILY COMPATIBILITY INFORMATION
  4892.  
  4893. Brief summary of board characteristics:
  4894.  
  4895. AHA-1540:
  4896.  
  4897. High performance SCSI to ISA Bus Master host adapter. Most revisions support 
  4898. synchronous data transfer. Separate user's manual. Subset of AHA-154XA 
  4899. Adapter Commands available. 
  4900.  
  4901. W AHA-1542A:    
  4902.  
  4903. High performance SCSI to ISA Bus Master host adapter. Supports synchronous 
  4904. data transfer. Supports floppy disk drives. Higher level of host adapter 
  4905. integration. 
  4906.  
  4907. AHA-1542A:
  4908.  
  4909. High performance SCSI to ISA Bus Master host adapter. Supports synchronous 
  4910. data transfer. Supports floppy disk drives. Higher level of host adapter 
  4911. integration. Improved SCSI connection pattern and jumper controls. Supports 
  4912. Target Mode operation. 
  4913.  
  4914. AHA-1540A:
  4915.  
  4916. High performance SCSI to ISA Bus Master host adapter. Supports synchronous 
  4917. data transfer. Does not support floppy disk drives. Higher level of host 
  4918. adapter integration. Improved SCSI connection pattern and jumper controls. 
  4919. Supports Target Mode operation. 
  4920.  
  4921. AHA-1640:
  4922.  
  4923. Very high-performance SCSI-to-Micro Channel Bus Master host adapter. 
  4924. Supports synchronous data transfer. Does not support floppy disk drives. 
  4925. High level of host adapter integration. Supports Target Mode Operation. See 
  4926. Adaptec's AHA-1640 User's Manual for details, including POS management, 
  4927. differences in interrupt presentation, differences in reset management and 
  4928. improvements in Adapter commands. 
  4929.  
  4930. COMPATIBILITY CHART
  4931.  
  4932. Function                  1540      W1542A      1542A      1540A      1640
  4933. Floppy Disk Controller      No        Yes        Yes         No         No
  4934. Synchronous Transfer        No        Yes        Yes        Yes        Yes
  4935. Selectable DMA Speeds       No        Yes        Yes        Yes        POS
  4936. Programmable DMA Speeds    Yes        Yes        Yes        Yes        Yes
  4937. Internal SCSI Connectors Straight    Rt Angle   Rt Angle   Rt Angle   Straight
  4938. Scatter Gather              No        Yes        Yes        Yes        Yes
  4939. 64 Head BIOS              Option      Yes        Yes        Yes        Yes
  4940. 16 Head BIOS               Yes         No         No         No         No
  4941. LED Connector               No        Yes        Yes        Yes        Yes
  4942. Target Mode                 No         No        Yes        Yes        Yes
  4943. LA 17-19 Jumper            Yes        Yes         No         No         NA
  4944. Micro Channel               No         No         No         No        Yes
  4945. PC/AT                      Yes        Yes        Yes        Yes         No
  4946.  
  4947. NG B  tAWS Address Setup to MEMW Leading Edge
  4948.  
  4949.